Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
#MAX=10000000+20
|
||||
Global Dim P.b(#MAX) : FillMemory(@P(),#MAX,1,#PB_Byte)
|
||||
Global NewList Primes.i()
|
||||
Global NewList Strong.i()
|
||||
Global NewList Weak.i()
|
||||
|
||||
For n=2 To Sqr(#MAX)+1 : If P(n) : m=n*n : While m<=#MAX : P(m)=0 : m+n : Wend : EndIf : Next
|
||||
For i=2 To #MAX : If p(i) : AddElement(Primes()) : Primes()=i : EndIf : Next
|
||||
|
||||
If FirstElement(Primes())
|
||||
pp=Primes()
|
||||
While NextElement(Primes())
|
||||
ap=Primes()
|
||||
If NextElement(Primes()) : np=Primes() : Else : Break : EndIf
|
||||
If ap>(pp+np)/2.0 : AddElement(Strong()) : Strong()=ap : If ap<1000000 : c1+1 : EndIf : EndIf
|
||||
If ap<(pp+np)/2.0 : AddElement(Weak()) : Weak()=ap : If ap<1000000 : c2+1 : EndIf : EndIf
|
||||
PreviousElement(Primes()) : pp=Primes()
|
||||
Wend
|
||||
EndIf
|
||||
|
||||
OpenConsole()
|
||||
If FirstElement(Strong())
|
||||
PrintN("First 36 strong primes:")
|
||||
Print(Str(Strong())+" ")
|
||||
For i=2 To 36 : If NextElement(Strong()) : Print(Str(Strong())+" ") : Else : Break : EndIf : Next
|
||||
PrintN("")
|
||||
EndIf
|
||||
PrintN("Number of strong primes below 1'000'000 = "+FormatNumber(c1,0,".","'"))
|
||||
PrintN("Number of strong primes below 10'000'000 = "+FormatNumber(ListSize(Strong()),0,".","'"))
|
||||
If FirstElement(Weak())
|
||||
PrintN("First 37 weak primes:")
|
||||
Print(Str(Weak())+" ")
|
||||
For i=2 To 37 : If NextElement(Weak()) : Print(Str(Weak())+" ") : Else : Break : EndIf : Next
|
||||
PrintN("")
|
||||
EndIf
|
||||
PrintN("Number of weak primes below 1'000'000 = "+FormatNumber(c2,0,".","'"))
|
||||
PrintN("Number of weak primes below 10'000'000 = "+FormatNumber(ListSize(Weak()),0,".","'"))
|
||||
Input()
|
||||
Loading…
Add table
Add a link
Reference in a new issue