Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/Totient-function/Perl/totient-function-2.pl
Normal file
13
Task/Totient-function/Perl/totient-function-2.pl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use utf8;
|
||||
binmode STDOUT, ":utf8";
|
||||
|
||||
use ntheory qw(euler_phi);
|
||||
|
||||
my @𝜑 = euler_phi(0,10000); # Returns list of all values in range
|
||||
|
||||
printf "𝜑(%2d) = %3d%s\n", $_, $𝜑[$_], $_ - $𝜑[$_] - 1 ? '' : ' Prime' for 1 .. 25;
|
||||
print "\n";
|
||||
|
||||
for $limit (100, 1000, 10000) {
|
||||
printf "Count of primes <= $limit: %d\n", scalar grep {$_ == $𝜑[$_] + 1} 0..$limit;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue