From dad48aca8f39803536d2d9a62fe448f634109108 Mon Sep 17 00:00:00 2001 From: Antti H S Laaksonen Date: Sun, 15 Oct 2017 14:55:34 +0300 Subject: [PATCH] Fix modpow data type [closes #55] --- chapter21.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter21.tex b/chapter21.tex index 0859612..8e50ef9 100644 --- a/chapter21.tex +++ b/chapter21.tex @@ -432,7 +432,7 @@ $x^n \bmod m$: \begin{lstlisting} int modpow(int x, int n, int m) { if (n == 0) return 1%m; - int u = modpow(x,n/2,m); + long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u;