Search arXivSearch

arXiv · 2401.10497

An Elementary Method For Fast Modular Exponentiation With Factored Modulus

Abstract

We present a fast algorithm for modular exponentiation when the factorization of the modulus is known. Let $a,n,m$ be positive integers and suppose $m$ factors canonically as $\prod_{i=1}^k p_i^{e_i}$. Choose integer parameters $t_i\in [1, e_i]$ for $1\le i\le k$. Then we can compute the modular exponentiation $a^n\pmod{m}$ in $O(\max(e_i/t_i)+\sum_{i=1}^k t_i\log p_i)$ steps (i.e., modular operations). We go on to analyze this algorithm mathematically and programmatically, showing significant asymptotic improvement in specific cases. Specifically, for an infinite family of $m$ we achieve a complexity of $O(\sqrt{\log m})$ steps, much faster than the Repeated Squaring Algorithm, which has complexity $O(\log m)$. Additionally, we extend our algorithm to matrices and hence general linear recurrences. The complexity is similar; with the same setup we can exponentiate matrices in $GL_d(\mathbb{Z}/m\mathbb{Z})$ in less than $O(\max(e_i/t_i)+d^2\sum_{i=1}^k t_i\log p_i)$ steps. This improves Fiduccia's algorithm and the results of Bostan and Mori in the case of $\mathbb{Z}/m\mathbb{Z}$. We prove analogous results for $\mathbb{Z}/p^k\mathbb{Z}$ ring extensions.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Anay Aggarwal, Manu Isaacs. 2024-09-11. An Elementary Method For Fast Modular Exponentiation With Factored Modulus. https://arxiv.org/abs/2401.10497

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Asymptotic density of k-almost primes

Landau's well known asymptotic formula $$N_k(x):=\ \mid\{n\leq x : Ω(n)=k\}\mid \ \sim \left( \frac{x}{\log x} \right) \frac{(\log\log x)^{k-1}}{(k - 1)!}\ \ (x \rightarrow \infty),$$ which also holds for $$π_k(x):=\ \mid\{n\leq x : ω(n)=k\}\mid,$$ is known to be fairly poor for $k > 1$, and when $k$ is allowed to tend to infinity with $x$, the study of $N_k(x)$ and $π_k(x)$ becomes very technical [1, Chapter II.6, $§$ 6.1, p.200]. I hope to show that the method described below provides not only a more accurate approach, but rather increases in its asymptotic accuracy as $k$ tends to infinity.

math.NT

Transcendence Meets Normality: Construction of Transcendentally Normal Numbers

In this work, we study real numbers $x$ for which $p(x)$ is (absolutely) normal for every non-constant integer-valued polynomial $p$. We call such numbers transcendentally normal. We prove that almost every real number is transcendentally normal and provide an explicit construction of such a number, based on Sierpinski's covering method and novel ideas involving the so-called stretch function. In the next step, we transform this construction into an algorithm that computes the digits of a t-normal number recursively in all integer bases. Moreover, we extend our covering approach to construct and compute LIL-normal numbers whose discrepancies are of the order predicted by the law of the iterated logarithm. We also take the opportunity to discuss several interesting open problems.

math.NT