3 ms·
It is. The sum of decimals is much faster than the modulo.
by rurban 7y ago
It 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).