From 5562d7327db32088aaa9c61e06d502289dd85e10 Mon Sep 17 00:00:00 2001 From: Antti H S Laaksonen Date: Sat, 18 Mar 2017 12:20:26 +0200 Subject: [PATCH] Fix bug when n<2 and m=1 [closes #24] --- chapter01.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter01.tex b/chapter01.tex index f921e08..c0fe4a8 100644 --- a/chapter01.tex +++ b/chapter01.tex @@ -331,7 +331,7 @@ long long x = 1; for (int i = 2; i <= n i++) { x = (x*i)%m; } -cout << x << "\n"; +cout << x%m << "\n"; \end{lstlisting} Usually the remainder should always