Tau function: Difference between revisions
→bc: add
(→Finding divisors efficiently: speed-up three times) |
(→bc: add) |
||
Line 596:
end</syntaxhighlight>
=={{header|bc}}==
<syntaxhighlight lang="bc">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)</syntaxhighlight>
=={{header|BCPL}}==
Line 1,925 ⟶ 1,935:
while n % p == 0:
t += a
n //= p
p += 2
if n != 1:
|