3 ms·
Casting out elevens is a related check, and only slightly harder; you add and subtract alternate digits, starting from the end. So 380258203 is congruent to 3-
by kragen 16y ago
Casting out elevens is a related check, and only slightly harder; you add and subtract alternate digits, starting from the end. So 380258203 is congruent to 3-0+2-8+5-2+0-8+3 mod 11, i.e. -5, which is (congruent to) 6 mod 11. The advantage it has over casting out nines is that it catches all digit transpositions and most inadvertent shifts. 12345 × 67890 is, mod 11, 3 × 9 = 27, which is 5 mod 11. 838102050 is also 5 mod 11, but none of the eight numbers you can obtain by transposing two adjacent digits in it are 5 mod 11, while they are all congruent to 838102050 (0) mod 9. Similarly, if you shifted one of the partial products over by one place by accident while adding up the final product, your result would fail the casting-out-elevens check unless that partial product was 0 mod 11.