Magnanimous numbers: Difference between revisions
→{{header|Raku}}: various style / efficiency tweaks
m (Swift - simplified code) |
Thundergnat (talk | contribs) (→{{header|Raku}}: various style / efficiency tweaks) |
||
Line 916:
{{works with|Rakudo|2020.02}}
<lang perl6>my @magnanimous = lazy flat ^10, (10 .. 1001)
my int $last;
(1 ..^ .chars
next if $last;
$_
} ),
(1002 .. ∞)
# optimization for numbers > 1001; First and last digit can not both be even or both be odd
next if (.substr(0,1)
my int $last;
(1 ..^ .chars
next if $last;
$_
|