Numbers with same digit set in base 10 and base 16: Difference between revisions
Content deleted Content added
Alextretyak (talk | contribs) Added 11l |
add FreeBASIC |
||
Line 380: | Line 380: | ||
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 |
75129 75621 86150 88165 91465 91769 96617 98711 99481 |
||
</pre> |
|||
=={{header|FreeBASIC}}== |
|||
<lang freebasic>function is_sds( byval n as integer ) as boolean |
|||
dim as boolean in_dec(0 to 9), in_hex(0 to 9) |
|||
dim as integer nd = n, dh |
|||
while nd |
|||
in_dec( nd mod 10 ) = true |
|||
nd \= 10 |
|||
wend |
|||
while n |
|||
dh = n mod 16 |
|||
if dh > 9 then return false |
|||
in_hex( dh ) = true |
|||
n \= 16 |
|||
wend |
|||
for i as uinteger = 0 to 9 |
|||
if in_dec(i) <> in_hex(i) then return false |
|||
next i |
|||
return true |
|||
end function |
|||
dim as integer i, c=0 |
|||
for i = 0 to 99999 |
|||
if is_sds(i) then |
|||
print using "##### ";i; |
|||
c+=1 |
|||
if c mod 10 = 0 then print |
|||
end if |
|||
next i</lang> |
|||
{{out}}<pre> 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 |
|||
</pre> |
</pre> |
||