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

hack? tsk tsk. if you get anything under 1000, it's probably quicker to subtract multiples of 70 until it gets to 2 digits - you should just memorize all the 2 digits multiples of 5,7,11,13, etc. Seriously, there aren't that many!

for example, here's a quicker way for 1353 than what staticshock posted. 1353 - 1100 = 253. and 253 - 220 = 33. And clearly 11 divides 33, so 11 divides 1353.

modular arithmetic ftw!



This is what I usually do. It is called "adding / subtracting tens", I believe.


looks like the GCD algorithm




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

Search: