Vampire number: Difference between revisions
→{{header|Perl 6}}: more efficient code, add concurrency
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: add libheader) |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: more efficient code, add concurrency) |
||
Line 2,422:
my $digits = $num.comb.sort;
my @fangs;
next if $num % $this;
my $that = $num div $this;
@fangs.push("$this x $that") if
}
}
constant @vampires =
next unless my @fangs = is_vampire($n);
}▼
}
Line 2,443 ⟶ 2,444:
say "\nIndividual tests:\n";
.say for (16758243290880, 24959017348650, 14593825548650).hyper(:1batch).map: {
my @fangs = is_vampire($_);
▲ }
}</lang>
<pre>First 25 Vampire Numbers:▼
▲First 25 Vampire Numbers:
1260: 21 x 60
Line 2,490 ⟶ 2,481:
16758243290880: 1982736 x 8452080, 2123856 x 7890480, 2751840 x 6089832, 2817360 x 5948208
24959017348650: 2947050 x 8469153, 2949705 x 8461530, 4125870 x 6049395, 4129587 x 6043950, 4230765 x 5899410
14593825548650: is not a vampire number.</pre>
=={{header|Phix}}==
|