Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
23
Task/Tau-function/Agena/tau-function.agena
Normal file
23
Task/Tau-function/Agena/tau-function.agena
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
scope # find the count of the divisors of the first 100 positive integers
|
||||
|
||||
# returns the number of divisors of v
|
||||
local proc divisor_count( v :: number ) :: number
|
||||
# numtheory.ifactors will return something like (e.g., for 24): [1, [[2, 3], [3, 1]]]
|
||||
local total := 1;
|
||||
if v > 1 then
|
||||
local constant factors := numtheory.ifactors( v );
|
||||
for f to size factors[ 2 ] do
|
||||
total *:= factors[ 2, f, 2 ] + 1
|
||||
od
|
||||
fi;
|
||||
return total
|
||||
end;
|
||||
scope
|
||||
local constant limit := 100;
|
||||
printf( "Count of divisors for the first %d positive integers:\n", limit );
|
||||
for n to limit do
|
||||
printf( "%3d", divisor_count( n ) );
|
||||
if n mod 20 = 0 then print() else printf( " " ) fi
|
||||
od
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue