22
Number Theory Speaker: P.H. Wu Date: 21/04/11 1

Number Theory Speaker: P.H. Wu Date: 21/04/11 1. Outline Introduction Residue number system Chinese remainder theory Euclid’s algorithm Stern-Brocot tree

Embed Size (px)

Citation preview

1

Number Theory

Speaker: P.H. WuDate: 21/04/11

2

Outline

• Introduction• Residue number system• Chinese remainder theory• Euclid’s algorithm• Stern-Brocot tree• Continuants• Conclusion

3

Introduction

• gcd: greatest common divisor• lcm: least common multiple• primes: p• factorial: n!• module: mod• module congruence: a b(mod m)• Application: encryption , combination and

permutation

4

Introduction

• Some primes1. Fermat prime

2. Mersenne prime

3.

22 1n

nF

2 1, p is prime.pnM

( ) : #

ln

x prime x

x

x

5

Residue number system

• Def: An integer x can be represented as a sequence of residue with respect to moduli that are prime to each other.

• Res(x) is unique if 0< x <m1m2…mr , or Res(x) = Res(x + km1m2…mr).

1 2 kRes( ) ( mod , mod ,..., mod ) for r jx x m x m x m m m

6

Residue Number systemX mod 12 X mod 3 X mod 4

0 0 0

1 1 1

2 2 2

3 0 3

4 1 0

5 2 1

6 0 2

7 1 3

8 2 0

9 0 1

10 1 2

11 2 3

Nice coding system!!!

Res( ) ( mod3, mod 4)

mod3

mod 4

Res( ) ( , )

Res(5) (2,1)

Res(10) (1,2)

Res(15) (3,3) (0,3)

Res(50) (2,2) (2,2)

x x x

a x

b x

x a b

7

Residue Number systemX mod 12 X mod 3 X mod 4

0 0 0

1 1 1

2 2 2

3 0 3

4 1 0

5 2 1

6 0 2

7 1 3

8 2 0

9 0 1

10 1 2

11 2 3

(1,0) 4

(0,1) 9

( , ) ( )mod12

(2,3) 2 (1,0) 3 (0,1)

2

(2,3)

3 35

35mod12 11

11 12

?

a

b

x y ax by

a b

x k

8

Chinese remainder theory

• 餘數定理

Find x ? x = 2·35a+21b+15c (mod 3·5·7)

mod3

mod5

mod7

x a

x b

x c

9

Euclid’s Algorithm

• 輾轉相除法192, 33

192 33 27

33 27 6

2

5

1

47 6

gcd( , ) gcd( , )

3

6 3 02

a q b r

a b b r

a b

5 192 133 1

165 27

4 27 6 2

24 6

3 0

10

Stern-Brocot tree

• Binary search tree1.

2. (n, m)=1

3.

4. 5/7LRRL

' '

' '

n n n n

m m m m

is unique.n

BSTm

n

m

'

'

n

m'

'

n n

m m

11

Stern-Brocot tree

• Example:

5 4

64 53 42 31

11 11 11 1120 9 9 7

11 11 2 25 3 1 1

2 2 2 11 64

1 11

R R R

R R L R

R R R L

R LR L

12

Stern-Brocot tree

• Binary search tree5.

n

m

'

'

n

m'

'

n n

m m

( ')

( ')

n n n

m m m

( ') '

( ') '

n n n

m m m

''

''

n nn n

m mm m

( ')

( ')

' ' 1 1

' ' 0 1

1 1

0 1

1 0

1 1

n n n

m m m

n n n n n

m m m m m

L

R

13

Stern-Brocot tree

• Example:

5 4

5 4

64 53 42 31

11 11 11 1120 9 9 7

11 11 2 25 3 1 1

2 2 2 11 64

1 11

0 1 1 0 1 1 1 0 1 1 29 35

1 0 1 1 0 1 1 1 0 1 5 6

R R R

R R L R

R R R L

R LR L

14

Continuants

• Any positive rational number can be represented as continuants.

0 i

1

2

34

1 a {0,1,2,...}

11

1...

r aa

aa

a

15

Continuants

• Continuant polynomial

• Example:

0

1 1 1

1 2 1 1 2 1 2 1 2 2

() 1;

( ) ;

( , ,..., ) ( , ,..., ) ( , ,..., );n n n n n n n

K

K x x

K x x x K x x x x K x x x

0

1 1 1

2 1 2 1 1 2 0 1 2

3 1 2 3 2 1 2 3 1 1 1 2 3 1 3

4 1 2 3 4 3 1 2 3 4 2 1 2

1 2 3 4 1 4 3 4 1 2

() 1;

( ) ;

( , ) ( ) () 1;

( , , ) ( , ) ( ) ;

( , , , ) ( , , ) ( , )

1;

K

K x x

K x x K x x K x x

K x x x K x x x K x x x x x x

K x x x x K x x x x K x x

x x x x x x x x x x

16

Continuants

• Continuant polynomial

• Example:

0

1 1 1

1 2 1 1 2 1 2 1 2 1

() 1;

( ) ;

( , ,..., ) ( , ,..., ) ( , ,..., );n n n n n n n

K

K x x

K x x x K x x x x K x x x

0

1 1 1

2 1 2 1 1 2 0 1 2

3 1 2 3 2 1 2 3 1 1 1 2 3 1 3

4 1 2 3 4 3 1 2 3 4 2 1 2

1 2 3

() 1 ;

( ) ;

( , ) ( ) () 1 ;

( , , ) ( , ) ( ) ;

( , , , ) ( , , ) ( , )

(1)

(1)

(2

)

(

5)

3)

(

K

K x x

K x x K x x K x x

K x x x K x x x K x x x x x x

K x x x x K x x x x K x x

x x x x

4 1 4 3 4 1 2 1

;

x x x x x x

17

Relation between Euclid’s Alg. and Continuants

1

1 0 2

2 1 3

3 2 4

4

3

(2)

(2) () (4,2)

(4,2

192, 33

192

) (2) (1,4,2)

(1,4,2) (4,2) (5,1,4,2)

(5,1,4

33 27

33 27 6

27 6 3

6 3 0

6 3 0

27 3 3 3

33 3 3 3

192 3 3 3

192 3

3

,2)

(1,4,2

5

1

4

2

4

)3 3

1

5

a b

K

K K K

K K K

K K K

K

K

1 2 2 1( , ,..., ) ( ,..., , )n n n nK x x x K x x x

18

Relation between Euclid’s Alg. and Continuants

192 27 1 15 5 5

633 33 33 / 27 127

1 1 1 5 5 5

1 1 11 1 1

3 127 / 6 4 46 6 / 3

1 5 5 1 4 2[ , , , ]

11

14

2

19

Relation between Stern-Brocot tree and Continuants

• Example:

• Path:

192 159 126 93

33 33 33 3360 27 27 21

33 33 6 615 9 3 3

6 6 6 3

3

0

R R R

R R L R

R L LR R

5 1 4 2 [ ,5 1, ]4,2R L R L

20

Relation between Stern-Brocot tree and Continuants

192 1 15 5

1 133 1 11 1

4 42 2 /1

1 5 [ , , , , ]

15 1 4 1 1

11

41

11

[ , ,5 1 4,1 1 5 1 4, ] [ , , , ]2

1 2 1 1 2( , ,..., 1) ( , ,..., ,1)n n n nK x x x K x x x

21

Other continuant property

• 1. mirror symmetry

• 2. more general recurrence

• 3. The number of terms is a Fibonacci number.

2 1 1 2( ,..., , ) ( , ,..., )n nK x x x K x x x

1 1

1 1

1 1 1 1 2

( ,..., , ,..., )

( ,..., ) ( ,..., )

+ ( ,..., ) ( ,..., )

m n m m m n

m m n m m n

m m n m m n

K x x x x

K x x K x x

K x x K x x

1(1,1,...,1)n nK F

22

Thanks for listening!!!