微信公众号:科文路。转发须注明出处。
Casting Out Nines,弃九法;用于检查整数乘法、加法的结果是否错误。
表述
“Casting out nines” is an elementary check of a multiplication which makes use of the congruence 10n≡110n≡1 (mod9mod9;mod 为取余数符号). Let decimal numbers be written a=an⋯a2a1a0a=an⋯a2a1a0, b=bn⋯b2b1b0b=bn⋯b2b1b0, and their product be c=cn⋯c2c1c0c=cn⋯c2c1c0. Let the sums of the digits of these numbers be a∗a∗, b∗b∗, and c∗c∗. Then a≡a∗a≡a∗ (mod9mod9), b≡b∗b≡b∗ (mod9mod9), and c≡c∗c≡c∗ (mod9mod9). Furthermore ab≡a∗b∗ab≡a∗b∗ (mod9mod9), so c≡c∗c≡c∗ (mod9mod9). So if cc and a∗b∗a∗b∗ are incongruent (mod9mod9), the multiplication has been done incorrectly.