Hacker News new | past | comments | ask | show | jobs | submit login

Another useful trick the other direction, which I'm sure is mentioned somewhere in the article or the comments but what the heck: if the sum of the digits of a number is divisible by 3, so is the original number itself.

123: 1 + 2 + 3 = 6, 6 rem 3 == 0, so 123 is cleanly divisible by 3.

123456789: sum is 45, 4+5 is 9, 9 rem 3 == 0, so 123456789 is divisible by 3.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: