On Monday, December 12, 2011 12:44:27 PM Chris Angelico did opine: > On Tue, Dec 13, 2011 at 2:55 AM, Nick Dokos <nicholas.do...@hp.com> wrote: > > Terry Reedy <tjre...@udel.edu> wrote: > >> calculations are helped by the fact that (a+b) % c == a%c + b%c, so > > > > As long as we understand that == here does not mean "equal", only > > "congruent modulo c", e.g try a = 13, b = 12, c = 7. > > This is the basis of the grade-school "casting out nines" method of > checking arithmetic. Set c=9 and you can calculate N%c fairly readily > (digit sum - I'm assuming here that the arithmetic is being done in > decimal); the sum of the remainders should equal the remainder of the > sum, but there's the inherent assumption that if the remainders sum to > something greater than nine, you digit-sum it to get the true > remainder. > > (Technically the sum of the digits of a base-10 number is not the same > as that number mod 9, but if you accept that 0 == 9, it works fine.) > > ChrisA
And that is precisely the reason I have failed to understand why the 1-10 decimal system seems to have hung on for several hundred years when it is clearly broken. Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) My web page: <http://coyoteden.dyndns-free.com:85/gene> Grub first, then ethics. -- Bertolt Brecht -- http://mail.python.org/mailman/listinfo/python-list