# Hexadecimal = n times decimal

Was explaining hexadecimal numbers to a friend and this made me wonder:

"Is there an hexadecimal number x that is a whole number n times its decimal value ?"

So for example the hexadecimal number 100 . $100_{16 }=256_{10}$ is thus 2.56 times its decimal value. (not a whole number)

But now which hexadecimal number is exactly 3 , 4 or another whole number times its decimal value?

PS: no guarantee given these numbers really exist, and have no idea what n means when it is greater than 9 (but you may think of it as hexadecimal or as decimal as you like)

Enjoy puzzling :)

• computers allowed? i'm going to write a python program... – Quintec Jun 4 '17 at 0:36
• Why not but there is nothing against the human handy work either – Willemien Jun 4 '17 at 0:38

I've looked for 2 and 3 digit solutions, and couldn't find any taking n as 2-11. There are quite a few 4 digit solutions, which can be found using algebra. I found the first few at n = 4:

$4096a + 256b + 16c + d = 4 \cdot (1000a + 100b + 10c + d)$ And doing a bit of casework, yields (in hexadecimal)

1038

1040

2078

2080

At this point, I am certain there are many many more, and write a python program. I set it to look for numbers less than a million, and with n less than 1000. It's still running, but here are some answers it gave, in the format $x_{16}$ (space) $n$:

1038 4 1040 4 2078 4 2080 4 2118 4 2120 4 3158 4 3160 4 3200 4 4198 4 4238 4 4240 4 5278 4 5280 4 5318 4 5320 4 6358 4 6360 4 6400 4 7398 4 7438 4 7440 4 8478 4 8480 4 8518 4 8520 4 9558 4 9560 4 9600 4 12480 6 25440 6 38400 6 112308 10 449440 10 565874 10 566080 10 678388 10 678400 10 794834 10 795040 10

I will post more as they come(EDIT: added rest of search from 1-1000000), but I feel like there are infinitely many solutions. As to proving that, I am not entirely sure how to go about it... any ideas?

For anyone with a more powerful computer than I, https://repl.it/I4vh

To supplement thecoder16's answer, here are the results of a computer search from $1$ to $10^{10}$:

1: 1, 2, 3, 4, 5, 6, 8, 7, 9
4: 1038, 1040, 2078, 2080, 2118, 2120, 3158, 3160, 3200, 4198, 4238, 4240, 5278, 5280, 5318, 5320, 6358, 6360, 6400, 7398, 7438, 7440, 8478, 8480, 8518, 8520, 9558, 9560, 9600
6: 12480, 25440, 38400
10: 112308, 449440, 565874, 566080, 678388, 678400, 794834, 795040
16: 1123080, 4494400, 5658740, 5660800, 6783880, 6784000, 7948340, 7950400
25: 11702482, 24257366, 35961083, 48537120
22: 17996800
35: 187605873
37: 154231124
40: 117024820, 242573660, 359610830, 485371200
41: 224321889, 789458685
42: 846059760
56: 1876058730
61: 1365665301, 1413490122
64: 1170248200, 2425736600, 3596108300, 4853712000
65: 3502669923, 4642454565
66: 1067455668
67: 4251168226, 6375695517
68: 6143199678

The only pattern I can see is that if the factor n is a multiple of 5, then you can append a zero to the number to get an answer for the factor $n*8/5$.

I used this C# code:

for( long d=1; d<10000000000L; d++)
{
long h = Convert.ToInt64(d.ToString(), 16);
if (h % d == 0) Console.WriteLine(d+": "+h/d);
}
• @oerkelens Nothing. Just a typo that has been fixed now. – Jaap Scherphuis Jun 4 '17 at 12:36
• ah, that's a much better algorithm then what I did :) – Quintec Jun 4 '17 at 15:52