user
Task

Find decimal numbers   **n**   that when converted to **hexadecimal** produce a number that uses the same set of digits (regardless of order and ignoring duplicates) as the original number,   where   **n  <  100000**

Example

The decimal number   **2339**   is   **923**   when written in hexadecimal.

The set of digits used,   ignoring order and duplicates,   is   **{2, 3, 9}**   in both cases and hence this number satisfies the task requirements.
assistant
Only bother to check numbers that could possibly match.

Several different interpretations of the (originally very vague) task instructions. It has now been clarified to mean the second.

```
say "Numbers up to 100,000 which when expressed in hexadecimal and in decimal
are composed of the same digit glyphs. (All the same glyphs, all the same
quantity.)\n";
display-numbers calculated-with &infix:<eqv>, <Bag>;

say "\nNumbers up to 100,000 which when expressed in hexadecimal and in decimal
are composed from the same digit glyphs. (All the same glyphs  are present,
possibly different quantity.)\n";
display-numbers calculated-with &infix:<eqv>, <Set>;

say "\nNumbers up to 100,000 which, when expressed in hexadecimal use glyphs
that are a subset of those used when expressed in decimal. (Every glyph in
decimal is present in hexadecimal the same or fewer (possibly zero) times)\n";
display-numbers calculated-with &infix:<⊆>, <Bag>;

say "\nNumbers up to 100,000 which, when expressed in hexadecimal use glyphs
that are a subset of those used when expressed in decimal. (Every glyph in
decimal is present in hexadecimal in some quantity, possibly zero, possibly more
than in decimal)\n";
display-numbers calculated-with &infix:<⊆>, <Set>;

sub display-numbers ($_) { say .elems ~ " found:\n" ~ .batch(20)».fmt('%5d').join: "\n" }

sub calculated-with ( &op, $container ) {
    cache ^18699 .map( {:16(.Str)} ).hyper(:1000batch).grep( {
        reduce( &op, (.fmt('%x'), $_).map: { .comb."$container"() } )
    } )
}

```

Output:

```
Numbers which when expressed in hexadecimal and in decimal are composed of
the same digit glyphs. (All the same glyphs, all the same quantity.)

34 found:
    0     1     2     3     4     5     6     7     8     9    53   371   913  4100  5141  5412  6182  8200  9241 75120
75121 75122 75123 75124 75125 75126 75127 75128 75129 75621 86150 91465 98711 99481

Numbers which when expressed in hexadecimal and in decimal are composed
from the same digit glyphs. (All the same glyphs are present, possibly
different quantity.)

69 found:
    0     1     2     3     4     5     6     7     8     9    53   371   913  1040  2080  2339  4100  5141  5412  5441
 6182  8200  9241 13593 13665 13969 16406 20530 26946 30979 32803 33638 33840 33841 33842 33843 33844 33845 33846 33847
33848 33849 34883 37943 38931 38966 38995 66310 71444 71497 71511 75120 75121 75122 75123 75124 75125 75126 75127 75128
75129 75621 86150 88165 91465 91769 96617 98711 99481

Numbers which, when expressed in hexadecimal use glyphs that are a subset
of those used when expressed in decimal. (Every glyph in decimal is present in
hexadecimal the same or fewer (possibly zero) times)

141 found:
    0     1     2     3     4     5     6     7     8     9    53   371   913  1040  1041  1042  1043  1044  1045  1046
 1047  1048  1049  1345  1937  2080  2081  2082  2083  2084  2085  2086  2087  2088  2089  2339  4100  5141  5412  6182
 8200  9241 12306 13593 13665 13969 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16743 18453 20513 20530
20546 21025 25169 25896 25986 26370 26738 26913 26930 26946 29217 29714 30768 30784 30979 32800 32801 32802 32803 32804
32805 32806 32807 32808 32809 32850 33589 33840 33841 33842 33843 33844 33845 33846 33847 33848 33849 34868 34880 34881
34882 34883 34884 34885 34886 34887 34888 34889 36902 36950 37492 37943 38931 38960 38961 38962 38963 38964 38965 38966
38967 38968 38969 38984 38995 39298 75120 75121 75122 75123 75124 75125 75126 75127 75128 75129 75621 86150 91465 98711
99481

Numbers which, when expressed in hexadecimal use glyphs that are a subset
of those used when expressed in decimal. (Every glyph in decimal is present in
hexadecimal in some quantity, possibly zero, possibly more than in decimal)

514 found:
    0     1     2     3     4     5     6     7     8     9    17    53    85   371   853   913  1024  1040  1041  1042
 1043  1044  1045  1046  1047  1048  1049  1345  1365  1604  1633  1635  1638  1689  1937  2048  2080  2081  2082  2083
 2084  2085  2086  2087  2088  2089  2178  2184  2339  4100  4160  4371  4417  4471  4481  4721  4913  4931  5140  5141
 5412  5441  5461  6168  6182  8200  8210  8320  8721  9241  9284  9523  9625  9762  9826  9862 10248 10258 10280 10529
12304 12305 12306 12307 12320 12340 12563 12593 12643 12803 12833 12834 12835 12853 12953 13056 13057 13059 13062 13072
13073 13075 13079 13080 13104 13105 13107 13124 13171 13175 13185 13187 13209 13364 13384 13427 13448 13459 13585 13587
13589 13593 13651 13653 13654 13665 13846 13862 13926 13969 14385 14387 14388 14739 16400 16401 16402 16403 16404 16405
16406 16407 16408 16409 16420 16480 16640 16704 16740 16742 16743 17408 17409 17425 17426 17428 17431 17442 17463 17473
17476 17479 17480 17495 17524 17745 18247 18440 18449 18452 18453 18456 18472 18483 18497 18504 18564 20485 20501 20512
20513 20514 20517 20530 20531 20533 20544 20546 20548 20549 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569
20576 20597 21025 21395 21504 21524 21540 21541 21845 21905 22357 22568 22658 24608 24610 24630 24640 24680 25106 25126
25169 25186 25361 25604 25634 25684 25896 25961 25986 26129 26130 26131 26134 26145 26146 26148 26150 26163 26184 26208
26210 26214 26248 26370 26407 26470 26471 26487 26658 26728 26738 26758 26913 26914 26918 26921 26930 26931 26934 26937
26946 26948 26965 26978 26982 26984 26985 28704 28706 28740 28807 29217 29337 29714 29764 29847 30467 30471 30517 30547
30567 30576 30579 30728 30768 30784 30976 30979 31097 32800 32801 32802 32803 32804 32805 32806 32807 32808 32809 32840
32850 33280 33587 33589 33638 33689 33840 33841 33842 33843 33844 33845 33846 33847 33848 33849 33864 34678 34820 34852
34867 34868 34871 34872 34880 34881 34882 34883 34884 34885 34886 34887 34888 34889 34948 34968 36902 36950 36960 37139
37169 37492 37529 37689 37779 37924 37940 37943 37945 38195 38791 38792 38793 38920 38931 38952 38960 38961 38962 38963
38964 38965 38966 38967 38968 38969 38984 38995 39048 39185 39187 39193 39200 39201 39202 39203 39204 39205 39206 39207
39208 39209 39217 39218 39219 39225 39234 39241 39250 39251 39253 39257 39266 39267 39287 39298 39313 39315 39321 66310
67140 67190 69910 69913 69921 70001 70162 70513 71025 71206 71265 71266 71286 71440 71441 71442 71443 71444 71445 71446
71447 71448 71449 71462 71473 71489 71492 71495 71497 71504 71505 71509 71511 71526 71537 71539 71540 71541 71543 71569
71680 71748 71800 71808 71809 71815 71816 71940 71953 71957 71959 71961 71993 74129 75120 75121 75122 75123 75124 75125
75126 75127 75128 75129 75621 76129 78103 78131 78135 78136 78193 79153 79731 81940 82194 82241 82471 82514 84100 84104
86150 87315 87351 87415 88145 88152 88165 90163 91465 91665 91670 91671 91673 91682 91760 91761 91762 91763 91764 91765
91766 91767 91768 91769 92561 94617 95761 96017 96617 98581 98711 98712 98713 99481
```