Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Tau-function/Factor/tau-function.factor
Normal file
17
Task/Tau-function/Factor/tau-function.factor
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
USING: assocs formatting io kernel math math.primes.factors
|
||||
math.ranges sequences sequences.extras ;
|
||||
|
||||
ERROR: nonpositive n ;
|
||||
|
||||
: (tau) ( n -- count )
|
||||
group-factors values [ 1 + ] map-product ; inline
|
||||
|
||||
: tau ( n -- count ) dup 0 > [ (tau) ] [ nonpositive ] if ;
|
||||
|
||||
"Number of divisors for integers 1-100:" print nl
|
||||
" n | tau(n)" print
|
||||
"-----+-----------------------------------------" print
|
||||
1 100 10 <range> [
|
||||
[ "%2d |" printf ]
|
||||
[ dup 10 + [a,b) [ tau "%4d" printf ] each nl ] bi
|
||||
] each
|
||||
Loading…
Add table
Add a link
Reference in a new issue