Numbers in base-16 representation that cannot be written with decimal digits: Difference between revisions
Numbers in base-16 representation that cannot be written with decimal digits (view source)
Revision as of 13:02, 24 June 2021
, 2 years ago→{{header|Raku}}: trap some edge conditions I overlooked
m (→{{header|Wren}}: Iteration now starts at 1.) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: trap some edge conditions I overlooked) |
||
Line 83:
#Generate such numbers directly, up to a threshold:
put "\nGenerate: first {+$_}:\n", .batch(10)».map({ "{$_}({:16($_)})" })».fmt('%9s').join("\n") given
((1..^Inf).grep(* % 7).map
#Count such numbers directly, up to a threshold
my $upto = 500;
put "\nCount: " ~ [+] flat (map {exp($_, 6)}, 1..($upto.log(16).floor)
+(exp($upto.log(16).floor, 16) .. $upto).grep( { so all |.map: { .polymod(16 xx *) »>» 9 } });</lang>
{{out}}
<pre>Filter: 42 such numbers:
|