RosettaCodeData/Task/Tau-function/BCPL/tau-function.bcpl

27 lines
491 B
Plaintext

get "libhdr"
let tau(n) = valof
$( let total = 1 and p = 3
while (n & 1) = 0
$( total := total + 1
n := n >> 1
$)
while p*p <= n
$( let count = 1
while n rem p = 0
$( count := count + 1
n := n / p
$)
total := total * count
p := p + 2
$)
if n>1 then total := total * 2
resultis total
$)
let start() be
for n=1 to 100
$( writed(tau(n), 3)
if n rem 20 = 0 then wrch('*N')
$)