Blum integer: Difference between revisions

m
→‎{{header|Perl}}: also last-digit breakdown
(Added Perl)
m (→‎{{header|Perl}}: also last-digit breakdown)
Line 815:
}
 
my($i, @blum, %C);
my @nth = (26828, 1e5, 2e5, 3e5, 4e5);
 
my($i, @blum);
while (++$i) {
push @blum, $i if is_blum $i;
last if $nth[-1] == scalar @blum;
}
$C{substr $_, -1, 1}++ for @blum;
 
say '"The first fifty Blum integers:'\n" . table 10, @blum[0..49];
say table 10, @blum[0..49];
printf "The %7sth Blum integer: %9s\n", comma($_), comma $blum[$_-1] for @nth;
say '';
printf "$_: %6d (%.3f%%)\n", $C{$_}, 100*$C{$_}/scalar @blum for <1 3 7 9>;
 
</syntaxhighlight>
{{out}}
Line 840 ⟶ 843:
The 200,000th Blum integer: 4,275,533
The 300,000th Blum integer: 6,521,629
The 400,000th Blum integer: 8,802,377</pre>
 
1: 100005 (25.001%)
3: 100067 (25.017%)
7: 99989 (24.997%)
9: 99939 (24.985%)
</pre>
 
=={{header|Phix}}==
2,392

edits