Tau function: Difference between revisions
Content added Content deleted
(add task to aarch64 assembly raspberry pi) |
Not a robot (talk | contribs) (Add Draco) |
||
Line 953: | Line 953: | ||
readln; |
readln; |
||
end.</lang> |
end.</lang> |
||
=={{header|Draco}}== |
|||
<lang draco>proc nonrec tau(word n) word: |
|||
word count, total, p; |
|||
total := 1; |
|||
while n & 1 = 0 do |
|||
total := total + 1; |
|||
n := n >> 1 |
|||
od; |
|||
p := 3; |
|||
while p*p <= n do |
|||
count := 1; |
|||
while n % p = 0 do |
|||
count := count + 1; |
|||
n := n / p |
|||
od; |
|||
total := total * count; |
|||
p := p + 2 |
|||
od; |
|||
if n>1 |
|||
then total << 1 |
|||
else total |
|||
fi |
|||
corp |
|||
proc nonrec main() void: |
|||
byte n; |
|||
for n from 1 upto 100 do |
|||
write(tau(n):3); |
|||
if n%20=0 then writeln() fi |
|||
od |
|||
corp</lang> |
|||
{{out}} |
|||
<pre> 1 2 2 3 2 4 2 4 3 4 2 6 2 4 4 5 2 6 2 6 |
|||
4 4 2 8 3 4 4 6 2 8 2 6 4 4 4 9 2 4 4 8 |
|||
2 8 2 6 6 4 2 10 3 6 4 6 2 8 4 8 4 4 2 12 |
|||
2 4 6 7 4 8 2 6 4 8 2 12 2 4 6 6 4 8 2 10 |
|||
5 4 2 12 4 4 4 8 2 12 4 6 4 4 4 12 2 6 6 9</pre> |
|||
=={{header|Dyalect}}== |
=={{header|Dyalect}}== |