Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Arithmetic-derivative/Raku/arithmetic-derivative.raku
Normal file
14
Task/Arithmetic-derivative/Raku/arithmetic-derivative.raku
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use Prime::Factor;
|
||||
|
||||
multi D (0) { 0 }
|
||||
multi D (1) { 0 }
|
||||
multi D ($n where &is-prime) { 1 }
|
||||
multi D ($n where * < 0 ) { -D -$n }
|
||||
multi D ($n) { sum $n.&prime-factors.Bag.map: { $n × .value / .key } }
|
||||
|
||||
|
||||
put (-99 .. 100).map(&D).batch(10)».fmt("%4d").join: "\n";
|
||||
|
||||
put '';
|
||||
|
||||
put join "\n", (1..20).map: { sprintf "D(10**%-2d) / 7 == %d", $_, D(10**$_) / 7 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue