Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
9
Task/Totient-function/Raku/totient-function.raku
Normal file
9
Task/Totient-function/Raku/totient-function.raku
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use Prime::Factor;
|
||||
|
||||
my \𝜑 = 0, |(1..*).hyper.map: -> \t { t * [*] t.&prime-factors.squish.map: { 1 - 1/$_ } }
|
||||
|
||||
printf "𝜑(%2d) = %3d %s\n", $_, 𝜑[$_], $_ - 𝜑[$_] - 1 ?? '' !! 'Prime' for 1 .. 25;
|
||||
|
||||
(1e2, 1e3, 1e4, 1e5).map: -> $limit {
|
||||
say "\nCount of primes <= $limit: " ~ +(^$limit).grep: {$_ == 𝜑[$_] + 1}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue