Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,41 @@
sieve = proc (max: int) returns (array[bool])
prime: array[bool] := array[bool]$fill(1,max,true)
prime[1] := false
for p: int in int$from_to(2, max/2) do
if prime[p] then
for c: int in int$from_to_by(p*p, max, p) do
prime[c] := false
end
end
end
return(prime)
end sieve
n_factors = proc (n: int, prime: array[bool]) returns (int)
count: int := 0
i: int := 2
while i<=n do
if prime[i] then
while n//i=0 do
count := count + 1
n := n/i
end
end
i := i + 1
end
return(count)
end n_factors
start_up = proc ()
MAX = 120
po: stream := stream$primary_output()
prime: array[bool] := sieve(MAX)
col: int := 0
for i: int in int$from_to(2, MAX) do
if prime[n_factors(i,prime)] then
stream$putright(po, int$unparse(i), 4)
col := col + 1
if col//15 = 0 then stream$putl(po, "") end
end
end
end start_up