News for hackers. Stuff that matters.
Re:987654321 / 123456789 by Joker_vD on Thursday October 30, 2025 @09:51AM (#45760031)
Somewhat interesting, 123456789 * 8 is 987654312 (the last two digits are swapped). This holds for other bases as well: 0x123456789ABCDEF * 14 is 0xFEDCBA987654312.

Also, adding 123456789 to itself eight times on an abacus is a nice exercise, and it's easy to visually control the end result.

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.
Re:987654321 / 123456789 by monkpit on Thursday October 30, 2025 @03:36PM (#45764347)
> the last 2 digits are swapped

They are also +9 away from being in order.

And then 12345678 * 8 is 98765424 which is +9 away from also being in order.

Re:987654321 / 123456789 by monkpit on Friday October 31, 2025 @12:49PM (#45774085)
Oops - the second one was supposed to say +8
Re:987654321 / 123456789 by mechanicalpulse on Friday October 31, 2025 @06:42PM (#45777514)
I also went about looking at the difference rather than the order. In the hexadecimal case, the difference is 15 (0xEF vs 0x12). I thought, then, that for any base B with ascending digits A and descending digits D, (D-(B-1))/A=B-2.

For binary, it looks like (1-(b-1))/1=b-10 or (1-(2-1))/1=2-2=0 in decimal.

For trinary, it looks like (21-(b-1))/12=b-2 or (7-(3-1))/5=5/5=1 in decimal.

For quaternary, it looks like (321-(b-1))/123=b-2 or (57-(4-1))/27=54/27=2 in decimal.

Essentially and perhaps unsurprisingly, the size of the slices in the number pie get smaller the bigger the pie gets. In binary, the slice is the pie, which is why the division comes out to zero there.

Re:987654321 / 123456789 by debtta on Friday October 31, 2025 @04:30AM (#45769590)
On an 8 digit calculator the common variant of this was

    12345679 * 8 = 98765432