Numbers with same digit set in base 10 and base 16: Difference between revisions
Content deleted Content added
→Python :: Functional: Added a version expressed in terms of a list comprehension. |
|||
Line 1,013: | Line 1,013: | ||
71511 75120 75121 75122 75123 75124 75125 75126 75127 75128 |
71511 75120 75121 75122 75123 75124 75125 75126 75127 75128 |
||
75129 75621 86150 88165 91465 91769 96617 98711 99481</pre> |
75129 75621 86150 88165 91465 91769 96617 98711 99481</pre> |
||
or in terms of a list comprehension: |
|||
<lang python>for nh in ([ |
|||
(n, h) for n in range(0, 100000) |
|||
if ( |
|||
(h := hex(n)[2:]) |
|||
and set(str(n)) == set(h) |
|||
) |
|||
]): |
|||
print(nh)</lang> |
|||
<pre>(0, '0') |
|||
(1, '1') |
|||
(2, '2') |
|||
(3, '3') |
|||
(4, '4') |
|||
(5, '5') |
|||
(6, '6') |
|||
(7, '7') |
|||
(8, '8') |
|||
(9, '9') |
|||
(53, '35') |
|||
(371, '173') |
|||
(913, '391') |
|||
(1040, '410') |
|||
(2080, '820') |
|||
(2339, '923') |
|||
(4100, '1004') |
|||
(5141, '1415') |
|||
(5412, '1524') |
|||
(5441, '1541') |
|||
(6182, '1826') |
|||
(8200, '2008') |
|||
(9241, '2419') |
|||
(13593, '3519') |
|||
(13665, '3561') |
|||
(13969, '3691') |
|||
(16406, '4016') |
|||
(20530, '5032') |
|||
(26946, '6942') |
|||
(30979, '7903') |
|||
(32803, '8023') |
|||
(33638, '8366') |
|||
(33840, '8430') |
|||
(33841, '8431') |
|||
(33842, '8432') |
|||
(33843, '8433') |
|||
(33844, '8434') |
|||
(33845, '8435') |
|||
(33846, '8436') |
|||
(33847, '8437') |
|||
(33848, '8438') |
|||
(33849, '8439') |
|||
(34883, '8843') |
|||
(37943, '9437') |
|||
(38931, '9813') |
|||
(38966, '9836') |
|||
(38995, '9853') |
|||
(66310, '10306') |
|||
(71444, '11714') |
|||
(71497, '11749') |
|||
(71511, '11757') |
|||
(75120, '12570') |
|||
(75121, '12571') |
|||
(75122, '12572') |
|||
(75123, '12573') |
|||
(75124, '12574') |
|||
(75125, '12575') |
|||
(75126, '12576') |
|||
(75127, '12577') |
|||
(75128, '12578') |
|||
(75129, '12579') |
|||
(75621, '12765') |
|||
(86150, '15086') |
|||
(88165, '15865') |
|||
(91465, '16549') |
|||
(91769, '16679') |
|||
(96617, '17969') |
|||
(98711, '18197') |
|||
(99481, '18499')</pre> |
|||
=={{header|Quackery}}== |
=={{header|Quackery}}== |