Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Tau-function/EMal/tau-function.emal
Normal file
18
Task/Tau-function/EMal/tau-function.emal
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
fun divisorCount = int by int n
|
||||
int total = 1
|
||||
for ; (n & 1) == 0; n /= 2 do ++total end
|
||||
for int p = 3; p * p <= n; p += 2
|
||||
int count = 1
|
||||
for ; n % p == 0; n /= p do ++count end
|
||||
total *= count
|
||||
end
|
||||
if n > 1 do total *= 2 end
|
||||
return total
|
||||
end
|
||||
int limit = 100
|
||||
writeLine("Count of divisors for the first " + limit + " positive integers:")
|
||||
for int n = 1; n <= limit; ++n
|
||||
text value = text!divisorCount(n)
|
||||
write((" " * (3 - value.length)) + value)
|
||||
if n % 20 == 0 do writeLine() end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue