Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
|
|
@ -1,90 +1,88 @@
|
|||
proc chowla n . sum .
|
||||
sum = 0
|
||||
i = 2
|
||||
while i * i <= n
|
||||
if n mod i = 0
|
||||
j = n div i
|
||||
if i = j
|
||||
sum += i
|
||||
else
|
||||
sum += i + j
|
||||
fastfunc chowla n .
|
||||
sum = 0
|
||||
i = 2
|
||||
while i * i <= n
|
||||
if n mod i = 0
|
||||
j = n div i
|
||||
if i = j
|
||||
sum += i
|
||||
else
|
||||
sum += i + j
|
||||
.
|
||||
.
|
||||
.
|
||||
i += 1
|
||||
.
|
||||
i += 1
|
||||
.
|
||||
return sum
|
||||
.
|
||||
proc sieve . c[] .
|
||||
i = 3
|
||||
while i * 3 <= len c[]
|
||||
if c[i] = 0
|
||||
call chowla i h
|
||||
if h = 0
|
||||
j = 3 * i
|
||||
while j <= len c[]
|
||||
c[j] = 1
|
||||
j += 2 * i
|
||||
.
|
||||
i = 3
|
||||
while i * 3 <= len c[]
|
||||
if c[i] = 0
|
||||
if chowla i = 0
|
||||
j = 3 * i
|
||||
while j <= len c[]
|
||||
c[j] = 1
|
||||
j += 2 * i
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
i += 2
|
||||
.
|
||||
i += 2
|
||||
.
|
||||
.
|
||||
proc commatize n . s$ .
|
||||
s$[] = strchars n
|
||||
s$ = ""
|
||||
l = len s$[]
|
||||
for i = 1 to len s$[]
|
||||
if i > 1 and l mod 3 = 0
|
||||
s$ &= ","
|
||||
.
|
||||
l -= 1
|
||||
s$ &= s$[i]
|
||||
.
|
||||
s$[] = strchars n
|
||||
s$ = ""
|
||||
l = len s$[]
|
||||
for i = 1 to len s$[]
|
||||
if i > 1 and l mod 3 = 0
|
||||
s$ &= ","
|
||||
.
|
||||
l -= 1
|
||||
s$ &= s$[i]
|
||||
.
|
||||
.
|
||||
print "chowla number from 1 to 37"
|
||||
for i = 1 to 37
|
||||
call chowla i h
|
||||
print " " & i & ": " & h
|
||||
print " " & i & ": " & chowla i
|
||||
.
|
||||
proc main . .
|
||||
print ""
|
||||
len c[] 10000000
|
||||
count = 1
|
||||
call sieve c[]
|
||||
power = 100
|
||||
i = 3
|
||||
while i <= len c[]
|
||||
if c[i] = 0
|
||||
count += 1
|
||||
.
|
||||
if i = power - 1
|
||||
call commatize power p$
|
||||
call commatize count c$
|
||||
print "There are " & c$ & " primes up to " & p$
|
||||
power *= 10
|
||||
.
|
||||
i += 2
|
||||
.
|
||||
print ""
|
||||
limit = 35000000
|
||||
count = 0
|
||||
i = 2
|
||||
k = 2
|
||||
kk = 3
|
||||
repeat
|
||||
p = k * kk
|
||||
until p > limit
|
||||
call chowla p h
|
||||
if h = p - 1
|
||||
call commatize p s$
|
||||
print s$ & " is a perfect number"
|
||||
count += 1
|
||||
.
|
||||
k = kk + 1
|
||||
kk += k
|
||||
i += 1
|
||||
.
|
||||
call commatize limit s$
|
||||
print "There are " & count & " perfect mumbers up to " & s$
|
||||
print ""
|
||||
len c[] 10000000
|
||||
count = 1
|
||||
sieve c[]
|
||||
power = 100
|
||||
i = 3
|
||||
while i <= len c[]
|
||||
if c[i] = 0
|
||||
count += 1
|
||||
.
|
||||
if i = power - 1
|
||||
commatize power p$
|
||||
commatize count c$
|
||||
print "There are " & c$ & " primes up to " & p$
|
||||
power *= 10
|
||||
.
|
||||
i += 2
|
||||
.
|
||||
print ""
|
||||
limit = 35000000
|
||||
count = 0
|
||||
i = 2
|
||||
k = 2
|
||||
kk = 3
|
||||
repeat
|
||||
p = k * kk
|
||||
until p > limit
|
||||
if chowla p = p - 1
|
||||
commatize p s$
|
||||
print s$ & " is a perfect number"
|
||||
count += 1
|
||||
.
|
||||
k = kk + 1
|
||||
kk += k
|
||||
i += 1
|
||||
.
|
||||
commatize limit s$
|
||||
print "There are " & count & " perfect mumbers up to " & s$
|
||||
.
|
||||
call main
|
||||
main
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue