aboutsummaryrefslogtreecommitdiff
path: root/numalgo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'numalgo.cpp')
-rw-r--r--numalgo.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/numalgo.cpp b/numalgo.cpp
index ee77afc..a8f2321 100644
--- a/numalgo.cpp
+++ b/numalgo.cpp
@@ -40,6 +40,7 @@ Bigint expmod(const Bigint &b,const Bigint &e,const Bigint &m){
assert(e>=0);
assert(m>=1);
if(m==1)return Bigint::zero;
+ if(e==0)return b;
Bigint res(1);
vector<bool> bits(e.bits());
for(int i=bits.size()-1;i>=0;i--){