Challenges
Fermat's little theorem
Cryptography
Easy
Fermat's little theorem
Solves: 7
Fermat's little theorem
Author: CyberSamSU
Points
20
Fermat's Little Theorem: if p is a prime number and a is not divisible by p, then a^(p-1) ≡ 1 (mod p).
A very useful conclusion follows from this: the exponent can be reduced modulo mod (p-1). That is, a^E mod p = a^(E mod (p-1)) mod p. Therefore, regardless of how many hundreds of digits the exponent has, the calculation is performed instantly.
Calculate a^E mod p for the following very large exponent E.
p = 16831203241
a = 15778967088
E = 2981278545155698078263095560721056813512636752398612608485781422
8845003374394558556316922407023615055679067611460888926396053598
087
Answer: only a number — in decimal format, without spaces and additional characters (for example 1234).
To submit a flag, log in.