Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some people investigate stuff like that, and hold on to the answer for a long time.

For this one, I guess you'd start by narrowing it down. The number must have the start-end pair of 1,2; 2,4; 3,6; or 4,8. That narrows it down to 4E16. Then you can narrow it down further by looking at what other digit-pairs are possible. You might assume it has a palindrome in the middle, but that digits near the end are not palindroms (e.g. it could have ...1001..., but couldn't be 101....102).

At some point, you might have enough simple rules like that to just use a computer.

Edit: I'm also interested in exactly how he figured it out, though.



Maybe you'd lop off the last few digits to make it easier: Let A be the highest digit, B be the lowest, and X be the ones in the middle. Find X, A, and B, where 2(X-A*E16+A+BE16-B)=X

That way, you can at least get each digit on one side, which might make it a more tractable problem. This is very frustrating! It's easy to narrow it down a whole lot, but it's still going to be intractable.


Spoiler Alert!

The number in general (I said, Spoiler Alert!) can be written as _y_ _x_ where 0 <= x <= 9 and the value of the number is 10y + x. Then it must satisfy for some k

2(10y+x) = (10^k)x + y

Simplify that and you can show that 10^k - 2 must be divisible by 19, which means k=17 (or 35, or 53, ...). Once you have that, pick x = 2, 3, or 4 and solve for y, and you have your 18-digit number. (Letting x = 1 gives you an 18-digit numbers whose first digit is 0, which doesn't count.)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: