Chowla numbers: Difference between revisions
m
→{{header|EasyLang}}
(Initial FutureBasic task solution added) |
|||
Line 1,387:
{{trans|Go}}
<syntaxhighlight lang="text">
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
.
.
return sum
.
proc sieve . c[] .
i = 3
while i * 3 <= len c[]
if c[i] = 0
while j <=
.
.
.
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]
.
.
print "chowla number from 1 to 37"
for i = 1 to 37
▲ print " " & i & ": " & h
.
proc main . .
print ""
len c[] 10000000
count = 1
power = 100
i = 3
while i <= len c[]
if c[i] = 0
count += 1
.
if i = power - 1
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
print s$ & " is a perfect number"
call commatize p s$▼
print "There are " & count & " perfect mumbers up to " & s$▼
▲ print "There are " & count & " perfect mumbers up to " & s$
.
call main
|