RosettaCodeData/Task/Tau-function/Bc/tau-function.bc

10 lines
221 B
Plaintext

define t(n) {
auto a, d, p
for (d = 1; n % 2 == 0; n /= 2) d += 1
for (p = 3; p * p <= n; p += 2) for (a = d; n % p == 0; n /= p) d += a
if (n != 1) d += d
return(d)
}
for (i = 1; i <= 100; ++i) t(i)