Loading [MathJax]/extensions/TeX/color.js

アルゴリズム論特論(塩田)第5回 (3) 九去法

九去法

 mod9 の法演算を応用した検算法を紹介しましょう。
Ex.8 367×52=19084 の検算をしてみましょう。
  • 被乗数、乗数、答えのそれぞれの 各桁の数字を足します
  • その数を 9 で割った余りを求めます
    ( 9 を超えたら 9 を引く = 九を取り去る、という naming です ) \require{color}
    被乗数\quad 367 \add 3+6+7 = (\textcolor{red}{3+6})+7 \delnine 7
    乗数 \quad 52 \add 5+2=7
    答え \quad 19084 \add 1+9+0+8+4=(\textcolor{red}{1+8})+\textcolor{red}{9}+4 \delnine 4
  • 「 被乗数から得られた 7 」と「 乗数から得られた 7 」を掛けた 7 \times 7 でまた同じことをします。
  • 7 \times 7 = 49 \add 4 + \textcolor{red}{9} \delnine 4
  • 「 答えから得られた 4 」と一致したので一安心します。
原理 \bmod 9 では \textcolor{blue}{10 \equiv 1}, \textcolor{red}{9 \equiv 0} なので、 \begin{eqnarray*} 367 &=& 3 \times \textcolor{blue}{10}^2 + 6 \times \textcolor{blue}{10} + 7 \\ &\equiv& 3 \times \textcolor{blue}{1}^2 + 6 \times \textcolor{blue}{1} + 7 \\ &\equiv& 3+6+7 = (\textcolor{red}{3+6})+7 \equiv 7 \pmod{9},\\ 52 &=& 5 \times \textcolor{blue}{10} + 2 \\ &\equiv& 5 \times \textcolor{blue}{1} + 2 \equiv 7 \pmod{9},\\ 19084 &=& 1 \times \textcolor{blue}{10}^4 + 9 \times \textcolor{blue}{10}^3 + 8 \times \textcolor{blue}{10} + 4 \\ &\equiv& 3 \times \textcolor{blue}{1}^4 + 9 \times \textcolor{blue}{1}^3 + 8 \times \textcolor{blue}{1} + 4 \\ &\equiv& 1 + 9 + 8 + 4 = (\textcolor{red}{1+8}) + \textcolor{red}{9} + 4 \equiv 4 \pmod{9}\\ \end{eqnarray*} という計算ができ、
367 \times 52\equiv 7 \times 7 \equiv 4 \equiv 答え \pmod{9}
のはず、ということです。
 計算間違えは繰り上がりなどで 1 とか 2 とかずれていることが多いので、 電卓のない時代にはこの方法が結構重宝したらしいです。