On the Inversion Modulo a Power of an Integer
On the Inversion Modulo a Power of an Integer
Recently, Koc proposed a neat and efficient algorithm for computing $x = a^{-1} \pmod {p^k}$ for a prime $p$ based on the exact solution of linear equations using $p$-adic expansions. The algorithm requires only addition and right shift per step. In this paper, we design an algorithm that computes $x = a^{-1} \pmod {n^k}$ for any integer $n>1$. The algorithm has a motivation from the schoolbook multiplication and achieves both efficiency and generality. The greater flexibility of our algorithm is explored by utilizing the build-in arithmetic of computer architecture, e.g., $n=2^{64}$, and experimental results show significant improvements. This paper also contains some results on modular inverse based on an alternative proof of correctness of Koc algorithm.
Guangwu Xu、Yunxiao Tian、Bingxin Yang
数学
Guangwu Xu,Yunxiao Tian,Bingxin Yang.On the Inversion Modulo a Power of an Integer[EB/OL].(2025-06-03)[2025-06-17].https://arxiv.org/abs/2506.02491.点此复制
评论