Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Chapter 4

Number Theory
Divisibility
}
m devides n
or m\n
n is divisible by m

If m>0 and the ratio m\n is an integer, then n is divisible by m.

m\n <=> m>0 and n=mk


fot some integer k

Then what’s the difference betn n/m and m\n?

n/m gives both int and float. But m\n always gives int.

5/2 -> 2.5


2\5 -> Invalid
GCD
(Greatest Common Divisor)
gcd(m,n)=max{k|k\m and k\n} lcm(m,n)=min{k|m\k and n\k}

gcd(12,18)=6 lcm(12,18)=36

Euclids Algorithm:
gcd(m,n)=m’m+n’n

where,
m’ & n’ are integer and can be negative/positive number also
gcd(12,18)
Prove that if k\m and k\n then k\gcd(m,n)
Primes
Any positive number P is prime if P is divisible by 1 and P only.

Prime Factorization:

12=2X2X3

18=2X3X3
Prove that, any positive integer (n) can be written as a product of primes and it is unique
Prime-exponent Representation
1. k=mn kp=mp+np

2. k=gcd(m,n) kp=min(mp , np)

3. k=lcm(m,n) kp=max(mp , np)


Factorials
𝑛
𝑛 ! =1 . 2 .......... 𝑛= ∏ 𝑘
𝑘= 1

n n!
0 1
1 1
2 2
0! = 1
3 6 n! = (n-1)!n
4 24
5 120
6 720
7 5040
Prove that n! increases exponentially or n! is plenty big.

You might also like