Remix.run Logo
zdimension 12 hours ago

57 is 3 times 19.

The standard divisibility rule for 3, 6 and 9 in base 10 is to sum the digits until you only have one left and check if it's one of those. Here, 5+7=12, 1+2=3, so 57 is divisible by 3.

squigz 3 hours ago | parent | next [-]

Math is not my strong suit at all, so I probably won't grok this, but that kind of blows my mind, so I'm curious... how?! That works for any arbitrarily large number?

Math is crazy!... still don't want to study it though!

moring 2 hours ago | parent | next [-]

Yes. A number like

123456 = 1 * 100000 + 2 * 10000 + 3 * 1000 + 4 * 100 + 5 * 10 + 6 = 1 * (99999+1) + 2 * (9999+1) + 3 * (999+1) + 4 * (99+1) + 5 * (9+1) + 6

When checking whether it is a multiple of some k, you can add/subtract multiples of k without changing the result, and those 99...9 are multiples of both 3 and 9.

So 123456 is a multiple of 3 (or 9) iff

1 * 1 + 2 * 1 + 3 * 1 + 4 * 1 + 5 * 1 + 6 * 1 = 1 + 2 + 3 + 4 + 5 + 6

is. Apply the same rule as often as you want -- that is, until you only have one digit left, because then it won't get simpler anymore.

an hour ago | parent | prev [-]
[deleted]
jeffbee 12 hours ago | parent | prev [-]

Ah I see what is meant by recursively here. Thanks!