Colorful numbers: Difference between revisions
Content added Content deleted
Alextretyak (talk | contribs) (Added 11l) |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: use 'hyper' not 'race') |
||
Line 1,136: | Line 1,136: | ||
} |
} |
||
put "Colorful numbers less than 100:\n" ~ (^100). |
put "Colorful numbers less than 100:\n" ~ (^100).hyper.grep( &is-colorful).batch(10)».fmt("%2d").join: "\n"; |
||
my ($start, $total) = 23456789, 10; |
my ($start, $total) = 23456789, 10; |
||
Line 1,149: | Line 1,149: | ||
for 2..8 { |
for 2..8 { |
||
put "$_ digit colorful number count: ", |
put "$_ digit colorful number count: ", |
||
my $c = +(flat $start.comb.combinations($_).map: {.permutations».join».Int}). |
my $c = +(flat $start.comb.combinations($_).map: {.permutations».join».Int}).hyper.grep( &is-colorful ), |
||
" - {($c / (exp($_,10) - exp($_-1,10) ) * 100).round(.001)}%"; |
" - {($c / (exp($_,10) - exp($_-1,10) ) * 100).round(.001)}%"; |
||
$total += $c; |
$total += $c; |