Number Theory
Number Theory
Number Theory
ap−1 ≡ 1 (mod p)
Where p is a prime number and a is any positive integer.
aφ(n) ≡ 1 (modn)
1 1 1
If and only if gcd(a, n) = 1. Also, φ(n) = n 1 − 1− ··· 1 − where n = pa11 pa22 · · · pakk
p1 p2 pk
x ≡ a1 (modr1 )
≡ a2 (modr2 )
≡ a3 (modr3 )
···
≡ ak (modrk )
* Determine the smalllest four digit integer n such that the last 4 digits of n2 is n.
n ≡ 1(mod625)
16a ≡ 1
16a ≡ −624
a ≡ −39
a ≡ 586(mod625)
a = 625b + 586
Thus, the value of n for the first case is n = 16(625b + 586) = 10000b + 9376. The smallest value
of n in that case is 9376.
(b) n ≡ 0(mod625), n − 1 ≡ 0(mod16)
So we have n ≡ 0(mod625) ≡ 1(mod16)
n ≡ 1(mod16)
625a ≡ 1
a ≡ 1(mod16)
a = 16b + 1
Thus, we have n = 625(16b + 1) = 10000b + 625 The smallest value of n in this case is 625.
Finally, the smallest value of a four-digit n is 9376 .
4. Wilson’s Theorem
For a prime p,
(p − 2)! ≡ 1(modp)
*Determine the remainder when 2014! is divided by 2017. Since 2017 is a prime, by Wilson’s theorem,
2015! ≡ 1(mod2017)
2015! ≡ 1(mod2017)
2015 ∗ 2014! ≡ 1(mod2017)
−2 ∗ 2014! ≡ −2016(mod2017)
2014! ≡ 1008 (mod2017)