BBS: Inland Empire Archive Date: 02-15-93 (15:17) Number: 323 From: MARK HARRIS Refer#: NONE To: ALL Recvd: NO Subj: Prime Number prog Conf: (2) Quik_Bas
CALL SetDisplayScrn(Total, n) 'This is the main
'screen
OPEN "c:\tmp\prime.num" FOR RANDOM AS #1
'^^^^^^^^ set whatever path you'd like
FOR n = 1 TO 7 'This starts us off
READ num 'seeding some numbers
PUT #1, n, num 'to work with
NEXT n
count = 7
FOR n = 17 TO 10000000 STEP 2 'This is the main loop
COLOR Starwhite, Ltblue
LOCATE 7, 46: PRINT n;
LOCATE 9, 45: PRINT Total;
FOR i = 3 TO count - 3
a$ = INKEY$
IF a$ = CHR$(27) THEN Endprogram
IF a$ = "V" OR a$ = "v" THEN View.primes (count)
GET #1, i, prime
test = n / prime
test2 = INT(test)
test3 = test2 - test
IF test3 = 0 THEN GOTO 10
NEXT i
CALL Record.prime(count, Total, n)
10 : NEXT n
DATA 1,2,3,5,7,11,13
'The data above is the first few primes.
'They are needed to determine the ones
'that come after them, since any whole
'number can be written as the product
'of two primes.
SUB Endprogram
'Here's part of the professional look I
'wanted to illustrate. It just isn't
'nice to leave garbage from your
'program littering someones screen.
'I always include this to reset
'everything the way it probably
'started.
COLOR White, Black
CLS
END
END SUB
SUB Introscreen 'This sub give basic information
'about the program before it
'actually does it's stuff
... OFFLINE 1.50 "Quit worrying about your health. It will go away."
--- MsgToss 2.0d(beta) 12/17/92
* Origin: JW-PC Consulting DataFlex.HST (608)837-1923 (1:121/8)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET