Wasteful, equidigital and frugal numbers: Difference between revisions
Wasteful, equidigital and frugal numbers (view source)
Revision as of 10:26, 22 July 2022
, 1 year ago→{{header|Raku}}: white space tweaks
Thundergnat (talk | contribs) m (→{{header|Raku}}: DRY, factor out common code, add caching, efficiency tweaks, more alliterative naming.) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: white space tweaks) |
||
Line 332:
my $upto = 1e6.Int;
my atomicint ($extravagant, $equidigital, $economical);
say "\nOf the positive integers up to {$upto.&cardinal}
(1..^$upto).race(:5000batch).map: { .&extravagant($base) ?? ++⚛$extravagant !! .&equidigital($base) ?? ++⚛$equidigital !! ++⚛$economical };
say " Extravagant: {comma $extravagant}\n Equidigital: {comma $equidigital}\n Economical: {comma $economical}";
Line 364:
10,000th: 1,953,125
Of the positive integers up to one million
Extravagant: 831,231
Equidigital: 165,645
Line 395:
10,000th: 2,659,171
Of the positive integers up to one million
Extravagant: 795,861
Equidigital: 200,710
|