Fermat Theorem
a^(p-1) = 1 mod p , where p is prime and gcd(a, p)=1
Also known as Fermat's litte Theorem
Useful in public key and primality testing
Alternative form of Fermat's theorm:
a^p = a mod p ,not require gcd(a,p)=1
example: p=5, a=3 ---> 3^5 = 3 mod 5
p=5,a=10-----> 10^5= 10 mod 5
Euler Totient Function Ø(n)
Number of elements in reduced set of residues is called the Euler Tolient Function Ø(n)
By convention, Ø(1)=1 约定
when doing arithmetic modulo n:
- Complete set of residues is : 0....n-1
- Reduced set of residues is those numbers which are relatively prime to n
for example:
n=10,
complete set of residues is {0123456789}
reduced set of residues is {1 3 7 9}
for a prime p , Ø(p) =p -1
for a composite n= p*q (p,q are prime)
Ø(n)= Ø(p*q )= Ø(p) Ø(q)= (p-1)(q-1)
怎么求一个大数的欧拉函数值?????方法如下,拆分
example: Ø(37)= 36
Ø(21)=Ø(3*7)=Ø(3)Ø(7)=2*6=12
Euler's Theorem
A generalisation 归纳 of Fermat Theorem
a^Ø(n)= 1 mod n, for any a,n where gcd(a,n)=1
Alternative form: a^(Ø(n)+1) = a(mod n) , not require gcd(a,n)=1