Numbers in base-16 representation that cannot be written with decimal digits
This is literally the exact same task as (the horribly named) Base-16 representation task.
Leaving aside the requirement that it be base 16 (well, base negative 16 according to the task title); assume it really means hexadecimal, otherwise all bets are off.
I challenge anyone to demonstrate how, say 46510, can be written in hexadecimal using only decimal digits.
The task as written:
put "{+$_} such numbers:\n", .batch(20)».fmt('%3d').join("\n")given (1..500).grep( { so any |.map: { .polymod(16 xx *) »>» 9 } } );
Find numbers in decimal that when written in hexadecimal are expressed using only alphabetic glyphs.
Which is a tiny (2 character) change from Base-16 representation. Add some other (possibly useful) functionality.
#Filter out such numbers from a range:put "Filter: {+$_} such numbers:\n", .batch(20)».fmt('%3d').join("\n")given (1..500).grep( { so all |.map: { .polymod(16 xx *) »>» 9 } } );#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( { .base(7).trans: [1..6] => ['A'..'F'] } )).grep(!*.contains: 0)[^42];#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 } });