3 ms·
> Checking for 9 might be easier in decimal It isn't. The test is the same in both cases.
by thaumasiotes 7y ago
> Checking for 9 might be easier in decimal
It isn't. The test is the same in both cases.
- rurban 7y agoIt is. The sum of decimals is much faster than the modulo.
- thaumasiotes 7y agoHuh? You need modulus either way. n is zero (mod 3) iff its digit sum is zero (mod 3), and it's zero (mod 9) iff its digit sum is zero (mod 9).