Download Number Theory

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Elliptic curve primality wikipedia , lookup

Wieferich prime wikipedia , lookup

Mersenne prime wikipedia , lookup

Addition wikipedia , lookup

Sieve of Eratosthenes wikipedia , lookup

Prime number theorem wikipedia , lookup

List of prime numbers wikipedia , lookup

Transcript
Number Theory
Primes numbers
A positive integer p is prime iff it is evenly divisible by exactly two positive
integers: itself and 1.
• The single digits primes are 4 numbers:
2357
• The two digits primes are 21 numbers:
11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
• The three digits primes are 143 numbers:
101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191
193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283
293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401
409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509
521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631
641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751
757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877
881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997
• A list of the 10,000 smallest prime numbers is available at:
http://www.math.utah.edu/~pa/math/p10000.html
• There are infinitely many primes.
• Primes do thin out as numbers get bigger:
o The density of primes < 2 digit numbers is 1 / 4.
o The density of primes < 3 digit numbers is 1 / 6.
o The density of primes < 10 digit numbers is 1 / 23.
o The density of primes < 100 digit numbers is 1 / 230.
In general, the density is inversely proportional to their length in digits.
• In RSA a common size prime is 100 digit and thus a random 100 digit has a
chance of 1 in 230 of being prime.
i.e., on average it will be necessary to select 230 hundred digit numbers
before a prime is found.
Euclid’s Algorithm
Finding the multiplicative inverse m-1 of m (mod n) ,
where m and n are relatively primes (the GCD of m and n is 1).
Initial Step:
r-2 = m, u-2 = 1, v-2 = 0
r-1 = n, u-1 = 0, v-1 = 1
i=0
Step i:
If ri-1 = 1 then ui-1 is the multiplicative inverse m-1 of m (mod n).
Otherwise:
Divide ri-2 by ri-1 to get quotient qi and remainder ri
Set ui = ui-2 - qi ui-1 & vi = vi-2 - qi vi-1
Set i = i + 1
Repeat
Example 1:
m=7, n = 10
qi
ri
ui
vi
i
-2
7
1
0
-1
10
0
1
0
0
7
1
0
1
1
3
-1
1
2
2
1
3
-2
-1
Since r2 is 1 then m is 3
Example 2:
m=7, n = 15
i
qi
ri
ui
vi
-2
7
1
0
-1
15
0
1
7
1
0
1
-2
1
0
0
1
2
-1
Since r1 is 1 then m is -2 mod 15 = 13
Example 3:
m=797, n = 1047
i
qi
ri
ui
vi
-2
797
1
0
-1
1047
0
1
0
0
797
1
0
1
1
250
-1
1
2
3
47
4
-3
3
5
15
-21
16
4
3
2
67
-51
5
7
1
-490
373
-1
Since r5 is 1 then m is -490 mod 1047 = 557
The Chinese Remainder Theorem (CRT)
If p and q are relatively prime, then any number x has two equivalent
representations:
Standard: x mod pq
Decomposed: a=x mod p & b=x mod q
To covert from decomposed to standard we use Garner’s Formula:
x = (((a-b)( q-1 mod p)) mod p).q + b
The CRT can be used to speed up the computation is RSA and other
cryptography applications.
Euler’s Theorem:
Zn*
Zn = {i >=0: i <n}
Example: Z10 = {0,1,2,3,4,5,6,7,8,9}
Zn* = {i > 0: i <n and is relatively prime to n}
Example: Z10* = {1,3,7,9}
If you multiply any two numbers in Z10* you get another number in Z10*
Each raw and column in the Z10* multiplication table contains all the elements
of Z10* with no repeats.
1
3
7
9
1
1
3
7
9
3
3
9
1
7
7
7
1
9
3
9
9
7
3
1
Z10* Multiplication table
Zn* is closed under multiplication mod n.
Euler’s Totient Function
Ø(n) (called Euler’s Totient Function) is the number of elements in Zn*.
Example: Ø(10) = 4.
• If n is prime, then Ø(n) = n-1
• If n = pq where p and q are relatively prime, then
Ø(n) = Ø(p) Ø(q)
• If n= pq where p and q are primes, then Ø(n) = (p-1)(q-1).
Example: 10 = 2.5 and thus Ø(10) = (2-1).(5-1)=1.4=4
Euler’s Theorem:
For all a in Zn*: aØ(n) = 1 mod n
Generalized Euler’s Theorem:
If n = pq where p and q are distinct primes, then
For all a in Zn (not just Zn*): akØ(n)+1 = a mod n