Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,32 @@
|
|||
Main:
|
||||
include Settings
|
||||
say version; say 'Legendre Prime counter (no memoization)'; say
|
||||
numeric digits 10
|
||||
do n = 0 to 9
|
||||
call Time('r')
|
||||
a = 10**n; p = pi(a)
|
||||
say '10^'n Right(p,9) Format(Time('e'),3,3)'s'
|
||||
end
|
||||
exit
|
||||
|
||||
Pi:
|
||||
procedure expose prim.
|
||||
arg xx
|
||||
if xx < 3 then
|
||||
return 0+(xx=2)
|
||||
n = Primes(Isqrt(xx))
|
||||
return Phi(xx,n)+n-1
|
||||
|
||||
Phi:
|
||||
procedure expose prim.
|
||||
arg xx,yy
|
||||
if yy < 2 then
|
||||
return xx-(xx%2)*(yy=1)
|
||||
p = prim.prime.yy
|
||||
if xx <= p then
|
||||
return 1
|
||||
return Phi(xx,yy-1)-Phi(xx%p,yy-1)
|
||||
|
||||
include Abend
|
||||
include Functions
|
||||
include Sequences
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
Main:
|
||||
include Settings
|
||||
say version; say 'Legendre Prime counter (with memoization)'; say
|
||||
numeric digits 10
|
||||
do n = 0 to 9
|
||||
call Time('r')
|
||||
a = 10**n; p = Pi(a)
|
||||
say '10^'n Right(p,9) Format(Time('e'),3,3)'s'
|
||||
end
|
||||
exit
|
||||
|
||||
Pi:
|
||||
procedure expose prim. work.
|
||||
arg xx
|
||||
if xx < 3 then
|
||||
return 0+(xx=2)
|
||||
n = Primes(Isqrt(xx))
|
||||
work. = 0
|
||||
return Phi(xx,n)+n-1
|
||||
|
||||
Phi:
|
||||
procedure expose prim. work.
|
||||
arg xx,yy
|
||||
if yy < 2 then
|
||||
return xx-(xx%2)*(yy=1)
|
||||
p = prim.prime.yy
|
||||
if xx <= p then
|
||||
return 1
|
||||
if work.xx.yy > 0 then
|
||||
return work.xx.yy
|
||||
work.xx.yy = Phi(xx,yy-1)-Phi(xx%p,yy-1)
|
||||
return work.xx.yy
|
||||
|
||||
include Abend
|
||||
include Functions
|
||||
include Sequences
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
Main:
|
||||
include Settings
|
||||
say version; say 'Legendre Prime counter (sieving)'; say
|
||||
numeric digits 10
|
||||
do n = 0 to 8
|
||||
call Time('r')
|
||||
a = 10**n; p = Primes(a)
|
||||
say '10^'n Right(p,9) Format(Time('e'),3,3)'s'
|
||||
end
|
||||
exit
|
||||
|
||||
include Abend
|
||||
include Functions
|
||||
include Sequences
|
||||
Loading…
Add table
Add a link
Reference in a new issue