News for hackers. Stuff that matters.
Re:987654321 / 123456789 by andyjansson on Thursday October 30, 2025 @10:17AM (#45760272)
Another interesting thing is that these seem to work:

base 16: 123456789ABCDEF~16 * (16-2) + 16 - 1 = FEDCBA987654321~16

base 10: 123456789~10 * (10-2) + 10 - 1 = 987654321~10

base 9: 12345678~9 * (9-2) + 9 - 1 = 87654321~9

base 8: 1234567~8 * (8-2) + 8 - 1 = 7654321~8

base 7: 123456~7 * (7-2) + 7 - 1 = 654321~7

base 6: 12345~6 * (6-2) + 6 - 1 = 54321~6

and so on..

or more generally:

base n: sequence * (n - 2) + n - 1

Re:987654321 / 123456789 by madcaptenor on Thursday October 30, 2025 @12:30PM (#45761872)
This is in the original post, in the form

  num(b)/denom(b) = b - 2 + (b-1)/denom(b)
so you just need to clear the denominator.