## Re: [PrimeNumbers] a basic program for prime numbers

Expand Messages
• Burcin Aydogdu wrote: Hi all, Below is a gwbasic program that gives prime numbers infinitely. It is of course limited with the
Message 1 of 2 , Feb 8, 2006
Burcin Aydogdu <baydogdu2004@...> wrote: Hi all,

Below is a gwbasic program that gives prime numbers infinitely. It is of course limited with the capacity of the computer and the programming language's infrastructure.

This program uses an algorithm generating prime numbers as a series, without examining any of them by dividing into any previous primes.

It is not, however, proved in terms of mathematics. We could just test first 1000 primes listed and some random numbers smaller than 500.000, which all came out as prime numbers.

The program can count primes up to 200.000 because there are certain numbers in the series that must be skipped, and the greater the primes become, the more numbers the computer has to store in memory. Those numbers stored are only measures to calculate the numbers to be skipped in the series, so that all the outcoming numbers will be prime.

It gives all the primes, without missing any, and never gives any number that is not prime, as far as we tested. But as I said, it is a matter of mathematical knowledge to proof (or disproof) it, and it is a matter of memory and cpu power to obtain greater primes.

I will be thankful if you comment on the program.

11 varta=1:gelta=1:winta=1:atta(1)=9
15 tellioglu(1)=4:tellioglu(2)=20:seferoglu(1)=8:seferoglu(2)=28
17 input "kaca kadarki asallar yazilsin";j
20 a=a+1
40 asal=(6*a)-1:bir=-1
45 if a=aday(winner) then goto 50
47 goto 500
54 winner=var
*6)-1
90 gel=winner
200 asal=(6*a)+1:bir=1
210 if a=adarti(winnerti) then goto 215
212 goto 243
winnerti)+(winnerti*6)+1:goto 220
242 garti=winnerti:pasgec=1
243 if a=atta(winta) then pasgec=1:goto 245
244 goto 260
245 if varta=gelta then varta=varta+1:atta(varta)=(varta*5)-1+((varta*6)-1)
246 atta(gelta)=atta(gelta)+(gelta*6)-1
257 if atta(gelta)-(gelta*6)+1=>atta(winta) then atta(winta)=atta(winta)+(winta*
6)-1:goto 248
258 gelta=winta:pasgec=1
260 if a=tellioglu(1) then goto 280
261 if a=seferoglu(1) then goto 290
270 goto 300
280 tellioglu(3)=tellioglu(2)+(tellioglu(2)-tellioglu(1))+12
281 tellioglu(1)=tellioglu(2)
283 tellioglu(2)=tellioglu(3)
284 pasgec=1
285 goto 261
290 seferoglu(3)=seferoglu(2)+(seferoglu(2)-seferoglu(1))+12
291 seferoglu(1)=seferoglu(2)
293 seferoglu(2)=seferoglu(3)
294 pasgec=1
300 if pasgec=1 then pasgec=0:goto 20
500 rem
700 if asal>j then end
710 print asal;
730 if bir=1 then goto 20
740 goto 200

If anyone interested, I can also try to explain the function to generate these series.

Greetings,

Burcin Aydogdu

>There are far shorter algorithms

Cheers

Bob

---------------------------------
Yahoo! Mail - Helps protect you from nasty viruses.

[Non-text portions of this message have been removed]

Unsubscribe by an email to: primenumbers-unsubscribe@yahoogroups.com
The Prime Pages : http://www.primepages.org/

Mathematics education Mathematics and computer science Number theory

---------------------------------

To unsubscribe from this group, send an email to: