Fermat's little theorem - Wikipedia
https://en.wikipedia.org/wiki/Fermat's_little_theoremFermat's little theorem states that if p is a prime number, then for any integer a, the number a − a is an integer multiple of p. In the notation of modular arithmetic, this is expressed as For example, if a = 2 and p = 7, then 2 = 128, and 128 − 2 = 126 = 7 × 18 is an integer multiple of 7. If a is not divisible by p, Fermat's little theorem is equivalent to the statement that a − 1 is an integer multiple of p, or in symbols:
Number Theory - 1 | HackerEarth
www.hackerearth.com › practice › notesIntroduction: Problems in competitive programming which involve Mathematics are are usually about number theory, or geometry. If you know number theory, that increases your ammo heavily in solving a lot of tougher problems, and helps you in getting a strong hold on a lot of other problems, too.