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

Who wants to multiply by 9, though? The version of the 13 test I've seen has you multiply by 4 and add instead:

4173 -> 417 + (3 x 4) = 429 -> 42 + (9 x 4) = 78, which is divisible by 13, so 4173 is.

Of course, these two tests work for the same reason. You're saying 10a + b is divisible by 13 iff a - 9b is, I'm saying 10a + b is divisible by 13 iff a + 4b is, and those differ by 13b.



But multiplying by 9 is so easy! You can check you’re right if (a) the first digit of the result is 1 less than the number you started with, and (b) the digits sum to 9


or multiply by 10 and subtract the number that you were trying to multiply by 9. I.E.: 12 x 9 = 12 x 10 - 12 = 108


That’s how I taught my daughter.


but that only works up to 10.. my method works for any number, and you could adapt it for x11... see below


Lucky for us, all digits are less than 10.


What is 23 x 9 with that trick?


Just going off the trick above would t it just be: 23 x 10 - 23 = 230 - 23 = 207...

I guess I’m confused what point you’re making?


I was talking about the grand-parent comment's method:

> You can check you’re right if (a) the first digit of the result is 1 less than the number you started with

The first digit of the result is 2 ... And the number that you started with is also 2, which is not 1 less... I guess I am not smarter then a 5th grader


Wow! You definitely are smarter than me, the gp, at least! You’re right that my claim isn’t right in general. Hell, not even past 10, I can now see!

I’m curious, how did you find that counterexample? I kind of ‘overfitted’ my mental model to the first 10 integers. But as a statistician I’m only in the business of being approximately right...! Nice catch.

23x9=207 starts with 20 which is 3 less than 23... 24x9=216, and 21 is 3 less than 24. 11x9=99 and 9 is 2 less than 11, 12x9=108 and 10 is 2 less than 12. So 0-9 are offset by 1, 10-19 are offset by 2, 20-29 offset by 3, 30-49 offset by 4?




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

Search: