Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Home-primes/Perl/home-primes.pl
Normal file
12
Task/Home-primes/Perl/home-primes.pl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use ntheory 'factor';
|
||||
|
||||
for my $m (2..20, 65) {
|
||||
my (@steps, @factors) = $m;
|
||||
push @steps, join '_', @factors while (@factors = factor $steps[-1] =~ s/_//gr) > 1;
|
||||
my $step = $#steps;
|
||||
if ($step >= 1) { print 'HP' . $_ . "($step) = " and --$step or last for @steps }
|
||||
else { print "HP$m = " }
|
||||
print "$steps[-1]\n";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue