Substitute x in third congruence:
30u + 26
≡
3 (mod 7)
Solution is u
≡
6 (mod 7)
Thus u = 7v+6 [2]
From [1] and [2]
x = 30(7v+6) + 26 = 210u + 206
Therefore x
≡
206 (mod 210)
Note: m = 5*6*7 = 210, so we’re looking
for a solution modulo 210

Large integers and pseudoprimes

Representing large integers
Choosing m
1
,m
2
, …, m
n
to be pairwise relatively prime, we can represent any integer 0 < a < m =
m
1
m
2
…m
n
by an n-tuple
(a mod m
1
, a mod m
2
, …, a mod m
n
)
Example:
99, 98, 97, 95 are pairwise relatively prime
m = 99 * 98 * 97 * 95 = 89,403,930
Every integer 0…m can be represented uniquely by four remainders
123,684 = (33, 8, 9, 89)
123,684 mod 99 = 33
123,684 mod 98 = 8
123,684 mod 97 = 9
123,687 mod 95 = 89

Arithmetic with large integers
Arithmetic operations are carried out upon such tuples on a component basis, then we need to
solve a system of linear congruences
123,684 = (33,8,9,89)
413,456 = (32,92,42,16)
123,684 + 413,456 = (33,8,9,89) + (32,92,42,16)
= (65 mod 99, 100 mod 98, 51 mod 97, 105 mod 95) = (65, 2, 51, 10)
To compute the sum, we need to solve a system of congruences
x
≡
65 (mod 99)
x
≡
2 (mod 98)
x
≡
51 (mod 97)
x
≡
10 (mod 95)

Fermat’s Little Theorem
If p is prime and a is an integer not multiple of p then
a
p-1
≡
1 (mod p)
And for every integer a we have
a
p
≡
a (mod p)
Use case:
Find 7
222
mod 11
Fermat’s little theorem says 7
10
≡
1 (mod 11)
7
222
= 7
10x22+2
= (7
10
)
22
x
7
2
= 1
22
x 49
≡
5 (mod 11)
Find 6
138
mod 23
Fermat’s little theorem says 6
22
≡
1 (mod 23)
6
138
= 6
22x6+6
= (6
22
)
6
x 6
6
= 1
6
x 46656
≡
12 (mod 23)

Fermat to test for prime-ness
Fermat’s Little Theorem:
2
n-1
≡
1 (mod n)
if n is prime
However, in rare cases, the same congruence holds for composite numbers too,
e.g., for 341 = 11 x 31 [Question: does that mean that Fermat’s Little Theorem is wrong?] How often does the congruence hold for composite numbers? From all numbers less than 1010

Pseudorandom numbers Most pseudo-random number generators implemented in computers use the linear congruential method. They generate numbers based on a recurrence: xn+1= (axn+ c) mod m where x0= seed, a = multiplier, c = increment, and m = modulus We can divide xnto m to get a random number in (0,1) Question: how do we know that the mapping works well (does not map different numbers to the same value, and doesn’t go outside the interval)? The values a = 75, m = 231-1 and c = 0 (aka purely multiplicative generator) are used in practice. This generates 231-2 numbers before the first repetition.

#### You've reached the end of your free preview.

Want to read all 79 pages?

- Fall '14
- oskar
- Computer Science, Prime number, congruences