RosettaCodeData/Task/Tau-function/CLU/tau-function.clu

30 lines
637 B
Plaintext

tau = proc (n: int) returns (int)
total: int := 1
while n//2 = 0 do
total := total + 1
n := n/2
end
p: int := 3
while p*p <= n do
count: int := 1
while n//p = 0 do
count := count + 1
n := n/p
end
total := total * count
p := p+2
end
if n>1 then
total := total * 2
end
return(total)
end tau
start_up = proc ()
po: stream := stream$primary_output()
for n: int in int$from_to(1, 100) do
stream$putright(po, int$unparse(tau(n)), 3)
if n//20=0 then stream$putl(po, "") end
end
end start_up