Theory of Numbers
Natural Numbers
The numbers 1, 2, 3, , which are used in counting are called natural numbers or positive integers.
Divisibility of Integers
An integer x 0 divides y, if there exists an integer a such that y = ax and thus we write as x | y (x divides y).
If x does not divides y, we write as x \| y (x does not divides y )
[This can also be stated as y is divisible by x or x is a divisor of y or y is a multiple of x].
Properties of Divisibility
1. x | y and y | z x | z
2. x | y and x | z x | (ky lz ) for all k , l z. z = set of all integers.
3. x | y and y | x x = y
4. x | y, where x > 0, y > 0 x y
5. x | y x | yz for any integer z.
6. x | y iff nx | ny, where n 0.
2 Indian National Mathematics Olympiad
Test of Divisibility
Divisibility by certain special numbers can be determined without actually carrying out the process of
division. The following theorem summarizes the result :
A positive integer N is divisible by
2 if and only if the last digit (unit's digit) is even.
4 if and only if the number formed by last two digits is divisible by 4.
8 if and only if the number formed by the last three digits is divisible by 8.
3 if and only if the sum of all the digits is divisible by 3.
9 if and only if the sum of all the digits is divisible by 9.
5 if and only if the last digit is either 0 or 5.
25 if and only if the number formed by the last two digits is divisible by 25.
125 if and only if the number formed by the last three digits is divisible by 125.
11 if and only if the difference between the sum of digits in the odd places (starting from right) and
sum of the digits in the even places (starting from the right) is a multiple of 11.
Division Algorithm
For any two natural numbers a and b, there exists unique numbers q and r called respectively quotient
and remainder, a = bq + r , where 0 r < b.
Common Divisor
If a number c divides any two numbers a and b i.e., if c | a and c | b, then c is known as a common divisor
of a and b.
Properties of GCD
1. If ( b , c ) = g and d is a common divisor of b and c, then d is a divisor of g.
2. For any m > 0, (mb , mc ) = m (b , c )
b c 1
3. If d |b and d |c and d > 0, then , = (b , c )
d d d
b c
4. If ( b , c ) = g, then , =1
g g
5. If ( b , c ) = g, then there exists two integers x and y such that g = xb + yc
6. If (a , b ) = 1 and (a , c ) = 1, then ( a , bc ) = 1
7. If a | bc = 1 and (a , b ) = 1, then a | c = 1
Theory of Numbers 3
Note The representation in 5th property is not unique. In fact we can represent (a, b ) as xa + yb in infinite
number of ways where x , y Z
Z = set of all integers.
In above example, 252 is LCM of 18 and 28.
252 = 9.28
252 = 1418
.
(18, 28) = 2 . 28 + ( 3) 18
= 2.28 + 252K + ( 3)18 252K
= ( 2 + 9K )28 + ( 3 14K )18
where K is any integer.
Unit
1 is called unit in the set of positive integers.
Prime
A positive integer P is said to be prime, if
(i) P > 1
(ii) P has no divisors except 1 and P i.e., A number which has exactly two different factors, itself and
one, is called a prime number.
Thus, 2, 3, 5, 7, 11, ... are primes. 2 is the only even number which is prime. All other primes
being odd.
But the converse is not true i.e., every odd number need not be prime.
Composite
Every number (greater than one) which is not prime is called composite number. i.e., a number which has
more than two different factors is called composite. For example 18 is a composite number because 2, 3,
6, 9 are divisors of 18 other than 1 and 18.
We can also define a composite number as : A natural number n is said to be composite, if there exists
integers l and m such that n = lm, where 1 < l < n and l < m < n.
4 Indian National Mathematics Olympiad
Remark
l A prime number P can be written as a product only in one way namely P.1 .
l A composite number n can also be written as n.1. But composite number can be written in one more way
also as mentioned above.
l A composite number has at least three factors.
Twin Primes
A pair of numbers is said to be twin primes, if they differ by 2.
e.g., 3, 5 are twin primes.
Perfect Number
A number n is said to be perfect if the sum of all divisors of n (including n) is equal to 2n.
For example 28 is a perfect number because divisors of 28 are 1, 2, 4, 7, 14, 28.
Sum of divisors of n (= 28) = 1 + 2 + 4 + 7 + 14 + 28 = 56 = 2n
Coprime Integers
Two numbers a and b are said to be coprime, if 1 is only common divisors of a and b.
i.e., if GCD of a and b = 1 i.e., if (a , b ) = 1
e.g., (4, 5) = 1, (8, 9) = 1.
Theorem 1 If a = qb + r , then (a , b ) = (b , r ).
Remark
The above result can also be stated as :
GCD of a and b is same as GCD of b and r, where r is remainder obtained on dividing a by b.
Corollary If (a , b ) = 1, then (b , r ) = (a , b ) = 1
i.e., if a is coprime to b, then r is coprime to b. r is remainder obtained on dividing a by b.
Theory of Numbers 5
Theorem 2 If d is the greatest common divisor of a and b, then there exists integers x and y such that
d = xa + yb and d is the least positive value of xa + yb.
Proof
Case I By successive application of division algorithm to numbers a and b.
Let r1 , r2 , K , rn be successive remainders.
Therefore, a = bq1 + r1 , 0 < r1 < b (Dividing a by b)
b = r1q 2 + r2 , 0 < r2 < r1 (Dividing b by remainder r1 )
r1 = r2q3 + r3 , 0 < r3 < r2 (Dividing r1 by remainder r2 )
M
M
M
rn 2 = rn 1qn + rn , 0 < rn < rn 1
rn 1 = rn qn +1 + rn + 1, 0 < rn +1 < rn
Since r1 > r2 > K is a set of decreasing integers, this process must terminate after a finite number of step.
i.e., remainder must be zero after some stage.
So let rn +1 = 0 rn 1 = rn qn +1 + 0 = rn qn +1
rn | rn 1 (rn 1 , rn ) = rn [If a | b, then (a, b ) = a ]
Now, (a, b ) = (b, r1 ) = (r1 , r2 ) = (r2 , r3 ) = K = (rn 1 , rn ) = rn (i)
i.e., GCD of a and b is rn .
From first of above equations r1 = a bq1 = ax 1 + by1, where x 1 = 1, y1 = q ,
Putting the value of r1 = a bq1 in r2 = b r1q 2
r2 = b r1q 2 = b (a bq1 ) q 2 = b aq 2 + bq1q 2
= aq 2 + b (1 + q1q 2 ) = ax 2 + by 2 , where x 2 = q 2
y 2 = 1 + q1q 2
Similarly, r3 = ax 3 + by3 and so on rn = ax n + byn
or rn = ax + by
where x n = x and yn = y
i.e., GCD of a and b = rn can be expressed as (a , b ) = d = ax + by [By Eq. (i)]
Case II (a , b ) = d (Q d | a and d | b)
d | (ax + yb ) for all values of x and y.
an integer k such that xa + yb = kd (ii)
But least value of k is 1.
Putting k = 1 in Eq. (ii), least value of xa + yb is d.
Corollary If a and b are coprime integers i.e., if (a , b ) = 1, then there exists integers x and y such that
ax + by = 1
Solution Q (a, b ) = d
d | a and d | b [By definition of GCD].
There exists integers a1and b1 such that a = da1 (i)
b = db1 (ii)
Again Q (a, b ) = d
6 Indian National Mathematics Olympiad
Remark
(a, b ) = d and a = a1d , b = b1d , then a1 and b1 are coprime i.e., (a1, b1) = 1
Note If a|bc and (a, b ) = 1, then a|c. This result is also known as Gauss Theorem.
Example 5 Find GCD of 858 and 325 and express it in the form m 858 + n 325.
Solution 858 = 325.2 + 208 (i)
Dividing 858 by 325
325 = 2081
. + 117 (ii)
Dividing 325 by 208
208 = 1171
. + 91 (iii)
Dividing 208 by 117
117 = 911
. + 26 (iv)
Dividing 117 by 91
91 = 26.3 + 13 (v)
Dividing 91 by 26
26 = 13.2
GCD of 858 and 325 is d = 13
From Eq. (v), d = 13 = 91 26.3
Substituting the value of 26 from Eq. (iv)
91 3(117 911
. ) = 91 3117
. + 3.91 = 4.91 3117
.
Substituting the value of 91 from Eq. (iii)
= 4( 208 117) 3117
. = 4.208 7117
.
Substituting the value of 117 from Eq. (ii)
= 4.208 7( 325 2081) = 4.208 7.325 + 7.208
= 11.208 7.325
= 11( 858 325.2) 7.325 [Putting the value of 208 from Eq. (i)]
= 11.858 22.325 7.325 = 11.858 29.325
= m 858 + n.325 where m = 11, n = 29
Example 6 If a and b are relatively prime, then any common divisor of ac and b is a divisor of c.
Solution a and b are relatively prime
integers x and y such that
ax + by = 1 (i)
Let d be any common divisor of ac and b.
Q d | ac, an integer m such that
ac = dm (ii)
Q d | b, an integer n such that
b = dn (iii)
Multiplying both sides of Eq. (i) by c
acx + bcy = c (iv)
8 Indian National Mathematics Olympiad
Putting the values of ac and b from Eqs. (ii) and (iii) in Eq. (iv).
dmx + dncy = c
or d (mx + ncy ) = c
d|c
Example 7 If a and b are any two odd primes, show that (a 2 b 2 ) is composite.
Solution a 2 b 2 = (a b )(a + b )
Q a.0 and b are odd primes.
So, let a = 2k + 1
b = 2k + 1
a b = 2k + 1 2k 1 = 2k 2k = 2(k k ) is even
a + b = 2k + 1 + 2k + 1 = 2k + 2k + 2 = 2(k + k + 1) is even
Neither (a b ) nor (a + b ) is equal to 1.
Neither of the two divisors (a b ) and (a + b ) of (a 2 b 2 ) is equal to 1.
(a 2 b 2 ) is composite.
[Q Out of the two divisors of a prime number p, one must be equal to 1]
Example 10 Prove that an integer is divisible by 9 if and only if the sum of its digits is divisible by 9.
Solution Let a = an K a 3a 2a1 be an integer
[Note a is not the product of a1, a 2, a 3,, an but a1, a 2, a 3,,an are digits in the value of
a. For example 368 is not the product of 3, 6 and 8 rather 3, 6, 8 are digits in value
of 368
= 8 + 6 10 + 3 (10)2 ]
a = an a 3a 2a1
= a1 + (10)1a 2 + (10)2a 3 + (10)3a 4 + K + (10)n 1an
= a1 + 10a 2 + 100a 3 + 1000a 4 + K
= a1 + (a 2 + 9a 2 ) + (a 3 + 99a 3 ) + (a 4 + 999a 4 ) + ...
= (a1 + a 2 + a 3 + a 4 + K ) + ( 9a 2 + 99a 3 + 999a 4 + K ) (i)
or a = S + 9 (a 2 + 11a 3 + 111a 4 + ... )
where S = a1 + a 2 + a 3 + a 4 + K
is the sum of digits in the value of a
a S = 9 (a 2 + 11a 3 + 111a 4 + ... )
9 | (a S ) (ii)
Case I a is divisible by 9
i.e., 9 |a (iii)
9 | [a (a S )] [From Eqs. (ii) and (iii)]
i.e., 9|S i.e., sum of digits is divisible by 9.
Case II S (sum of digits) is divisible by 9
i.e., 9|S (iv)
From Eqs. (ii) and (iv), 9|[(a S ) + S ]
i.e., 9|a
i.e., the integer a is divisible by 9.
Note Therefore the product of two consecutive integers is divisible by 2! = 2 ; the product of any three
consecutive integers is divisible by 3 = 6! and so on.
Theory of Numbers 11
Example 1 Prove that product of two odd numbers of the form 4n + 1 is of the form ( 4n + 1) .
Solution Let a = 4k + 1, b = 4k + 1
be two numbers of the form ( 4n + 1)
ab = ( 4k + 1)( 4k + 1)
= 16kk + 4k + 4k + 1
= 4( 4kk + k + k ) + 1 = 4l + 1
(where l = 4kk + k + k )
Which is in form ( 4n + 1) .
Example 3(a) Show that sum of an integer and its square is even.
Solution Let n be any integer.
So, we have to prove that n 2 + n is even.
n 2 + n = n(n + 1) which is product of two consecutive numbers n and n + 1 and
hence divisible by 2! = 2
Hence, n 2 + n is an even number.
Solution Q 4x y is a multiple of 3.
4x y = 3m
y = 4x 3m
On putting value of y in 4x 2 + 7xy 2y 2
= 4x 2 + 7x ( 4x 3m ) 2 ( 4x 3m )2
= 4x 2 + 28x 2 21xm 2 (16x 2 + 9m 2 24xm )
= 4x 2 + 28x 2 21xm 32x 2 18m 2 + 48xm
= 27mx 18m 2 = 9m ( 3x 2m )
4x 7x 2y 2 is divisible by 9.
2
Solution Q m is an integer.
Either m is even or m is odd.
Case I m is even
So let m = 2k
Theory of Numbers 13
m 2 + 2 = ( 2k )2 + 2 = 4k 2 + 2 = 2 ( 2k 2 + 1)
= (2 an odd integer)
Which is not divisible by 4.
Case II m is odd
Let m = 2k + 1
m 2 + 2 = ( 2k + 1)2 + 2 = 4k 2 + 1 + 4k + 2
= ( 2 + 4k + 4k 2 ) + 1.
Which being an odd integer is not divisible by 4.
Remark
l
But converse is not true i.e., when p is prime, 2p 1 need not be prime.
l
For example, p = 11 is prime but 211 1 is divisible by 23 and hence is not prime.
Theorem 5 Fundamental Theorem of Arithmetic each natural number greater than 1 can be
expressed as a product of primes in one and only one way (except for the order of the factors).
Example 2 Show that every odd prime can be put either in the form 4k + 1 or 4k + 3 (i.e., 4k 1),
where k is a positive integer.
Solution Let n be any odd prime. If we divide any n by 4, we get
n = 4k + r
where 0 r < 4 i.e., r = 0, 1, 2, 3
Either n = 4k or n = 4k + 1
or n = 4k + 2 or n = 4k + 3
Clearly, 4n is never prime and 4n + 2 = 2( 2n + 1)
cannot be prime unless n = 0 (Q 4 and 2 can not be factors of an odd prime)
Theory of Numbers 15
Example 3 Show that there are infinitely many primes of the form 4n + 3.
Solution If possible, let number of primes of form ( 4n + 3) be finite.
These primes are 3, 7, 11,, q (put n = 0, 1, 2, )
Let q be the greatest of these primes of the form ( 4n + 3) .
Let a = 3, 7,11, K , q be the product of all primes of the form ( 4n + 3) .
Let b = 4a 1 (i)
b >1 [Qa 3, b = 4a 1, b 11]
By fundamental theorem b can be expressed as a product of primes say
p1. p2. p3 K pr .
i.e., b = p1. p2 K pr (ii)
Now, b = 4a 1 is odd and hence 2 can't be a factor of b.
None of the prime factors in RHS of Eq. (ii) is 2.
i.e., Every prime factor in RHS of Eq. (ii) is odd.
Each of p1, p2, K , pr is of the form ( 4n + 1) or ( 4n + 3) .
Again, all p1, p2, K , pr can't be of the form ( 4n + 1).
[Q If it were so, then b (their product) will also be of the form ( 4n + 1)] .
But this is contrary to Eq. (i) as b = 4a 1 is of the form ( 4n + 3) .
At least one of p1, p2 K pr (say p) is (a prime factor of b) of the form ( 4n + 3) i.e.,
p|b.
Also p|a [Q p is one prime of the form ( 4n + 3) and a is product of all such primes] .
p|4a
p | ( 4a b )
p |1 [Q from Eq. (i), 4a b = 1]
Which is impossible [Q p being prime > 1 ]
Our supposition is wrong.
Number of primes of the form ( 4n + 3) is infinite.
Qp1 is a prime number, therefore, the only divisors of p1 1 are 1, p1, p12 , p13 , K , p1 1
The number of these divisors of p1 1 = 1 + 1
Similarly, the number of divisors of p 2 2 = 2 + 1
The number of divisors of p k k = k + 1
Therefore, the total number of divisors of n = p1 1 p 2 2 K p k k = (1 + 1) ( 2 + 1) K ( k + 1)
i
[Q Every divisor of pi (1 i k ) is a divisor of n]
i.e., d (n ) = (1 + 1)( 2 + 1)( k + 1).
Note Let n = p11 p2 2 p3 3 [ p1, p2, p3 are distinct prime numbers]
Let d (n ) denotes number of divisor .
1. If n is a perfect square then d (n ) is odd
(Q all the di are even)
2. If n is not a perfect square then, d (n ) is even.
[The number of ways of writing n are the product of two factors.]
d (n ) + 1
If n is a perfect square, then number of ways are equal to .
2
d (n )
If n is not a perfect square, then number of ways are equal to .
2
Theorem 7 The sum of the divisors of any composite number n is denoted by (n ) which is equal to
p 1 + 1 1 p2 + 1 1 k + 1 1
1 2 K pk .
p1 1 p2 1 pk 1
Proof Let n be any composite number and let (n ) is sum of positive divisors of n. By Fundamental
Theorem of Arithmetic n can be expressed as the product of the powers of primes.
n = p1 1 . p 2 2 K p k k
[where p1 , p 2 , K , p k are distinct primes and 1 , 2 , K , k are non-negative integers]
Q p1 is prime number
divisors of p1 1 are only 1, p1 , p12 , K , p1 1
1 [ p1 + 1 1]
Sum of these divisors of p1 1 = 1 + p1 + p12 + K + p1 1 =
p 1
a (r n 1)
Q RHS is a Geometric Progression with a = 1, r = p1 , n = 1 + 1 and Sn = r 1
+1
(p2 2 1)
Similarly sum of divisors of p 2 2 =
p2 1
+1
(pk k 1)
Sum of divisors of p k k =
pk 1
(n ) = Sum of divisors of n = p1 1 p 2 2 ... p k k
+1 +1 +1
( p1 1 1) ( p 2 2 1) (p k 1)
= . K k .
( p1 1) ( p 2 1) ( p k 1)
i
[QEvery divisor of pi (1 i k ) is divisor of n]
Theory of Numbers 17
. ] = 5, = 1, [ ] = 4
5
[42
3
(2) If x 0, [x ] = 1
1 i x
(3) [x + m ] = [x ] + m , If m is an integer.
(4) [x ] + [y ] [x + y ] [x ] + [y ] + 1
(5) [x ] + [x ] = 0, If x is an integer = 1 otherwise.
18 Indian National Mathematics Olympiad
[x ]
(6) = , if m is a positive integer.
x
m m
(7) [x ] is the least integer greater than or equal to x.
This is denoted as (x ) (read as ceiling x)
. ) = 3, (25
For example, ( 25 . )= 2
(8) [x + 05
. ] is the nearest integer to x.
If x is midway between two integers, [x + 05
. ] represents the larger of the two integers.
(9) The number of positive integers less than or equal to n and divisible by m is given by
n
.
m
[a ] a
Theorem 1 If a is real number, c is natural number, then
c = c
Proof Let [a ] = n i.e., n is largest integer a
a = n + r, 0 r < 1 (i)
[a ] n
c = c = m
Let
n
= m + s, where 0 s < 1
c
n = mc + cs, where 0 cs < c (ii)
[a ]
LHS = = = m
n
Now,
c c
n + r
RHS = =
a
[Putting value of a from Eq. (i)]
c c
cs + r
= m +
c
From Eq. (ii), cs (c 1) and r < 1
Adding cs + r < c 1 + 1
cs + r < c
cs + r
<1
c
cs + r
RHS = m + =m
c
LHS = RHS.
Theory of Numbers 19
[x ] = 2m , = m
x
2
x + 1 = 2m + 1 + y = m
2 2
1 1+y
Since <1
2 2
x + x + 1 = [x ]
2 2
Then, x = m , x + 1 = (2m + 2) + y = m + 1
2 2 2
[x ] = 2m + 1
x + x + 1 = [x ]
2 2
n 333
p 2 = 3 = [111] = 111
n 111
p 3 = 3 = [ 37] = 37
n 37 1
p 4 = 3 = 12 3 = 12
n 12
p 5 = 3 = [ 4] = 4
n 4 1
p 6 = 3 = 1 3 = 1
n 1
p 7 = 3 = 0
Highest power of 3 contained in 1000!
n n n n n n n
= + 2 + p3 + p4 + p5 + p6 + p7
p p
= 333 + 111 + 37 + 12 + 4 + 1 + 0 = 498
20 Indian National Mathematics Olympiad
n + 1 2n
If n and k are positive integers and k is greater than 1, then +
n
Theorem 3
k k k
Proof Let n = qk + r , q and r are integers and
0 r k 1
n r n+1 r +1
Then, =q + , =q + ,
k k k k
2n 2r
= 2q +
k k
n + 1
(i) r < k 1, then = q , = q , 2q
n 2n
k k k
The desired result is immediate.
(ii) r = k 1, then
n = q , n + 1 = q + 1,
k k
2n = 2q + 2(k 1) = 2q + 1
k k
n + n + 1 = 2n
k k k
n n n n
Applying above formula to n , , , , ,K
2 4 8 16
n + 1
[n ] = +
n
2 2
n = n + (n / 2) + 1
2 4 2
n = n + (n / 4) + 1
4 8 2
n = n + (n / 8) + 1
8 16 2
Adding corresponding sides and cancelling out the terms , , , from both sides, we have
n n n
2 4 8
n + 1 n + 2 n + 4
n= + + +K
2 4 8
[n ] = n
Theory of Numbers 21
[x ] + x + + x + + K +
1 2 x + n 1 = [nx ]
n n n
Proof Let x = [x ] + y , where 0 y < 1
Let p be an integer such that
p 1 ny < p
(This is always possible because given a real number, we can always find two consecutive integers
between which the number lies).
k k
Now, x + = [x ] + y +
n n
k p 1+ k p+k
Also, y + lies between and
n n n
p 1+ k
So long as < 1,
n
i.e., k < n (p 1)
k
y + is less than 1 and consequently
n
k
x + n = [x ]
k
x + n = [x ]
i.e., for k = 0, 1, , n p
k
But x + = [x ] + 1, for k = n p + 1,, n 1
n
n 1
[x ] + x + + K + x +
1
n n
= [x ] + K + [x ](n p + 1 times) + ([x ] + 1) + ([x ] + 1) + K ( p 1) times
= n[x ] + ( p 1) (i)
Also, [nx ] = [n[x ] + ny ] = n[x ] + ( p 1)
Since p 1 ny < p (ii)
From Eqs. (i) and (ii)
n 1
[x ] + x + + x + + K + x +
1 2
= [nx ]
n n n
Proof Let k (n !)denote the highest power of p contained in n !n ! is the product of the factors 1, 2, 3, , n.
The factors in n ! which will be divisible by p are
n
p , 2p , 3p , K p
p
n n
k (n !) = + k ! (i)
p p
22 Indian National Mathematics Olympiad
n
Changing n to in Eq. (i)
p
n n n
k ! = 2 + k 2 ! (ii)
p p p
Putting the value from Eq. (ii) in Eq. (i)
n n n
k (n !) = + 2 + k 2 !
p p p
n n n
Continuing this process, we get k (n !) = + 2 + 3 + K
p p p
This process must end after a finite number of steps.
Congruences
If a and b are two integers and m is a positive integer, then a is said to be congruent to b modulo m, if m
divides a b denoted by m | (a b ).
In notation form we express it as a b mod m or a b 0 mod m.
Theorem 9 (i) Prove that a a mod m i.e., every integer is congruent to itself.
(ii) If a b mod m, then prove that b a mod m
(iii) If a b mod m, b c mod m prove that a c mod m
Proof (i) We know that m|0 (m 0)
m | (a a )
a a mod m [by definition of congruence]
(ii) Let a b mod m
m | (a b )
m | (a b ) or m | (b a )
b a mod m
(iii) Let a b mod m and b c mod m
m | ( a b ) and m | (b c )
m | ( a b ) + (b c ) or m | ( a c )
a c mod m
24 Indian National Mathematics Olympiad
1 2
Theorem 11 If a b mod m and f (x ) = p 0x n + p1x n + p 2x n + K +pn 1x + pn is an integral
rational function of an indeterminate x with integral coefficients, then f ( a ) f ( b ) mod m
1 2
Proof Q f ( x ) = p 0x n + p1x n + p 2x n + K + pn 1 x + pn
Putting x = a
1 2
f ( a ) = p 0an + p1an + p 2an + K + pn 1 a + pn (i)
Putting x = b
1 2
f (b ) = p 0bn + p1bn + p 2bn + K + pn 1b + pn (ii)
p!
Now, p
Cr = ; 1 r (p 1)
r !(p r )!
But p ! = 123
. . p is divisible by p
p is coprime to r !
Q p is coprime to 1, 2, 3, r (Qr < p , p is prime)
p is co prime to their product = r !
Also for the same reason p is coprime to (p r )!
p!
p
Cr = is divisible by p.
r !(p r )!
an integer k r such that
p
Cr = pk r
p
Putting this value of Cr in Eq. (i)
p 1
(a + b )p (ap + bp ) = p kr ap r br
r =1
which is divisible by p.
(a + b )p (ap + bp ) mod p
Generalization
If p is a prime number, prove that
(a1 + a 2 + a3 + K + an ) p
(a1p + ap2 + a3p + K + anp ) mod p
(a1 + a 2 + a3 + K + an ) p = (a1 + b1 ) p
where b1 = a 2 + a3 + K + an
(a1p + b1p ) mod p.
[a1p + (a 2 + a3 + K + an ) p ] mod p
[a1p + (a 2 + c 2 ) p ] mod p
where c 2 = a3 + a 4 + K + an (a1p + ap2 + c p2 ) mod p
continuing like this, we get
(a1 + a 2 + a3 + K + an ) p (a1p + ap2 + K + anp ) mod p
Replacing n by a.
ap = a mod p
26 Indian National Mathematics Olympiad
Proof As p is prime.
ap = a mod p
Cancelling a from both sides. [a is coprime to p]
p 1
We have a 1 mod p.
2 n 1 n
Theorem 15 n ! = nn n C1 (n 1)n + n C2 (n 2)n ... + (1)n Cn 22
n
+ (1)n Cn 1
2 3
We know that e = 1 + + + +K
1! 2! 3!
Using this expansion of e , Eq. (i) becomes
n
x x 2 x3 xn
1 + + + + K+ + K 1
1 ! 2 ! 3 ! n !
(nx )2 (nx )n (n 1)x [(n 1)x ]2 [(n 1)x ]n
+ K n C1 1 +
nx
= 1 + + + K+ + + K+ + K
1! 2! n!
1! 2! n!
(n 2) x [(n 2) x ]2 [(n 2) x ]n
+ n C2 1 + + +K + + K
1! 2! n!
n 2 2x (2x )2 (2x )n
+ K + n Cn 2 (1) 1 + + +K+ + K
1! 2! n
1n x x2 xn
+ (1)n Cn 1
1 + + + K+ + K + (1)n
1! 2! n!
n
Comparing coefficient of x on both sides
nn n (n 1)n (n 2)n
1= C1 + n C2 K+
n! n! n!
2n (1)n 1 n Cn 1
(1)n 2 n Cn 2 +
n! n!
Multiplying both sides by n !
2 n 1 n
n ! = nn n C1 (n 1)n + n C2 (n 2)n K + (1)n Cn 22
n
+ (1)n Cn 1
Q p is prime.
p is coprime to all numbers < p.
i.e., p is coprime to p 1, p 2, p 3, 2, 1.
Putting a = p 1, p 2, p 3, 2 in Fermat Theorem
ap 1 mod p
( p 1) p 1 1 mod p
or ( p 1) p 1 1 = M(p)
( p 1) p 1 = M ( p ) + 1
Similarly, ( p 2) p 1 = M ( p ) + 1
( p 3) p 1 = M ( p ) + 1
2p 1 = M ( p ) + 1
Putting these values of ( p 1) p 1 , ( p 2) p 1, , 2p 1 in Eq. (i).
p 1 p 1
( p 1)! = [M ( p ) + 1] C1[M ( p ) + 1] + C2[M ( p ) + 1] + .. + (1) p 3 p 1Cp 3
[M ( p ) + 1] + (1) p 2 p 1Cp 2
p 1
p 1 p 1
or ( p 1)! = M ( p ) + 1 C1 + C2 K + (1) p 3 Cp 3 + (1) p 2 p 1Cp 2
( p 1)! = M ( p ) + (1 1) p 1 (1) p 1
( p 1)! = M ( p ) + 0 (1) p 1 = M ( p ) 1
Qp is odd. p 1 is even.
(1) p 1 = 1
or ( p 1)! + 1 = M ( p )
( p 1)! + 1 is divisible by p.
( p 1)! + 1 0 mod p.
Now, 1 < p1 p 1
p1 is one of the factors in the value of ( p 1)! and therefore p1 divides ( p 1)! .
Also p = p1p 2 (i)
p1 | p (ii)
But ( p 1)! + 1 0 mod p
p | ( p 1)! + 1 (iii)
From Eqs. (ii) and (iii)
p1 | ( p 1)! + 1 (iv)
From Eqs. (iv) and (i)
p1 | ( p 1)! + 1 (p 1)!
i.e., p1 | 1
But this is impossible. (Qp1 > 1)
p is a prime number.
Eulers Function
Definition : The number of integers n and coprime to n is called Euler's function for n and is denoted by
(n ).
Examples
(1) = 1
[Q1 is the only integer 1 and coprime to 1].
( 2) = 1
[Q1 is the only integer < 2 and coprime to 2].
(8) = 4
[Q1, 3, 5, 7 are the only four integers < 8 and coprime to 8].
Remark
l
If p is a prime number, then 1, 2, 3, ( p 1) are all less than p and coprime to p and are ( p 1) in total.
( p) = p 1
1 1 1
Theorem 18 Prove that (n ) = n 1 1 K 1 where p1 , p 2 , ... , pr are distinct prime
p1 p2 pr
factors of n.
Proof Q p1 , p 2 , K , pr are distinct prime factors of n.
k k
n = p1 1 . p 2 2 K prkr
k k k k
(n ) = ( p1 1 . p 2 2 ... prkr ) = ( p1 1 ) ( p 2 2 ) K ( prkr )
[Qp1 , p 2 , K , pr are distinct primes and hence are coprime to each other and (ab ) = (a ) (b ), if a and b are
coprime to each other.]
k 1 k 1 1
= p1 1 1 p 2 2 1 K prkr 1
p1 p2 pr
k k 1 1 1
= p1 1 . p 2 2 K prkr 1 1 K 1
p1 p 2 pr
1 1 1 k k
= n 1 1 K 1 [Qn = p1 1 . p 2 2 K prkr ]
p1 p2 pr
Theory of Numbers 29
1
Theorem 19 Prove that ( p k ) = p k 1 , where p is prime.
p
Proof Number of integers from 1 to p k which are not coprime to p k are p.1, p.2, p.3, p. p k 1.
Total number of such integers, which are not coprime to p k = p k 1.
(p k ) = Number of integers coprime to p k and < p k .
= p k p k 1 = p k (1 1 / p )
Remark
If a and b are coprime to each other, then (ab ) = (a ) (b ).
Example 1 Find the number of positive integers 3600 that coprime to 3600.
Solution n = 3600 = 24 32 52
(n ) = ( 3600) = ( 24 32 52 )
1 1 1 1 1 1
= n 1 1 1 = 3600 1 1 1
p1 p2 p3 2 3 5
[Here p1 = 2, p2 = 3, p3 = 5]
1 2 4
= 3600
2 3 5
( 3600) = 960
Example 1 Let n be the natural number. If 2n + 1 and 3n + 1 are perfect square. Then prove that n
is divided by 40.
Solution 40 = 23 5. It is sufficient to prove that n is divisible by 8 and 5.
Let 2n + 1 = x 2 (i)
and 3n + 1 = y 2 (ii)
x 2 is odd.
x is odd.
Let x = 2a + 1
( 2n + 1) = ( 2a + 1)2
2n + 1 = 4a 2 + 4a + 1
n = 2a 2 + a
n is even.
If n is even 3n + 1 is odd
y 2 is odd y is odd
Let y = 2b + 1
Subtract Eq. (i) from Eq. (ii), we get
n = y2 x2 (iii)
Theory of Numbers 31
n = ( 2b + 1)2 ( 2a + 1)2
We know square difference of odd number is always divisible by 8.
n is divisible by 8. (iv)
If we eliminate n between 1 and 2
3x 2 2y 2 = 1
Since square of odd number ends with 1, 5 or 9
3x 2 ends with 3, 5 or 4, 7
2y 2 ends with 2, 0, 8
x 2 ends with 1 and y 2 ends with 1
n = y2 x2 [from Eq. (iii)]
=0
It is divisible by 5.
Example 2 Prove that there are infinitely many squares in the sequence 1, 3, 6, 10, 15, 21, 28,
Solution Suppose Tn is a square
n(n + 1)
Let Tn of the above sequence be
2
n(n + 1)
Tn =
2
If it is a square then Tn = (m )2
n(n + 1)
= (m )2
2
n(n + 1) = 2(m )2
Also, T4n (n + 1) is also a square.
4n(n + 1)[ 4(n )(n + 1) + 1]
T4n (n + 1) =
2
4( 2m 2 )[ 4n 2 + 4n + 1]
= = 4m 2( 2n + 1)2
2
T4n (n + 1)is also a perfect square.
perfect squares are T1 = 1
T8 = 36 is a perfect square.
T288 is also a perfect square.
Example 8 Determine all pairs of positive integers (m, n ) for which 2m + 3n is a perfect square.
Solution Let 2m + 3n = k 2
Since ( 1)m 2m k 2 1 (mod 3) (Q 3 | k )
m is even, say 2p.
Now, (k 2p ) (k + 2p ) = 3n
k 2 = 1 and k + 2 = 3n 2p + 1 + 1 = 3n
p p
Example 11 Find the number of values of n for which 211 + 28 + 2n is a perfect square.
Solution We can write 211 + 28 + 2n as
28 ( 23 + 1) + 2n
28 9 + 2n
2n ( 28n 9 + 1)
34 Indian National Mathematics Olympiad
Note that for any k < 8, 2k ( 28 k 9 + 1) is not a square, when k is odd, 2k is not a square
and in the other case, the second factor is not a square. Hence n 8. Now write
211 + 28 + 2n as 28( 9 + 2n 8 ). Then the problem is to find the number of non negative
integers k such that 9 + 2k is a square.
9 + 2k = t 2 2k = (t 3)(t + 3)
t 3 = 2p and t + 3 = 2p + q for some non negative integers p and q.
2p ( 2q 1) = 6 implying p = 1 from which it follows that t = 5.
Hence, there is a unique solution.
Example 13 Give with justification, a natural number n for which 39 + 312 + 315 + 3n is a perfect
cube .
Solution 39 + 312 + 315 + 3n = 39(1 + 34 + 36 + 3n 9 )
= ( 33 )3{1 + 3 32 + 3( 32 )2 + ( 32 )3 + 3n 9 3( 32 )2}
= ( 33 )3(1 + 32 )3 provided 3n 9 35 = 0
= ( 270)3 provided 3n 9 = 35
i.e., provided n = 14
So, given number is a perfect cube when n = 14
Example 15 A 4 digit number has the following properties (I) It is a perfect square (II) its first 2 digit
are equal to each other (III) its last two digit are equal to each other.Find all such four
digit number.
Solution We want to find positive integers x and y such that1 x 9,0 y 9 and xxyy is a
perfect square. Since,102 = 100, 1002 = 10000. It follows that xxyy must be the square
of a 2 digit number. Suppose that (ab )2 = xxyy .
The number xxyy is clearly a multiple of 11.
Since, it is a perfect square it must be a multiple of 112 i.e., 121.
It must be of the form
121 1, 121 4, 121 9, 121 16, 121 25,
121 36,121 49,121 64,121 81
Out of these 121 64 i.e., 7744 is of the form xxyy, we conclude that 7744 is the
desired number.
Example 16 Show that for any integer n, the number n 4 20n 2 + 4 is not a prime number.
Solution n 4 20n 2 + 4 = (n 4 4n 2 + 4) 16n 2
= (n 2 2)2 16n 2
= (n 2 4n 2)(n 2 + 4n 2) (i)
Note It can be easily seen that none of the factors n 2 4n 2 ,n 2 + 4n 2 can have the value 1,
whatever integral value n may have. Here four cases arises.
4 28
(i) n 2 4n 2 = 1 n =
2
4 20
(ii) n 4n 2 = 1 n =
2
2
4 28
(iii) n + 4n 2 = 1 n =
2
2
4 20
(iv) n + 4n 2 = 1 n =
2
2
From the above four cases, we find that whatever integral value n may have, n 4 20n 2 + 4 is the
product of the integers n 2 4n 2 and n 2 + 4n 2 neither of which equals 1..
Example 17 Prove that the product of four consecutive natural numbers cannot be a perfect cube.
Solution Consider the product
P = n (n + 1) (n + 2)(n + 3), where n is a natural number.
If possible, that P is a perfect cube = k 3 Two cases arises.
Case I If n is odd. n, (n + 1), (n + 3) are all prime to n + 2
Now, we know that every common divisor of n + p and n + q must divide q p.
36 Indian National Mathematics Olympiad
Example 18 Find all primes p for which the quotient ( 2p 1 1)| p is a square.
Solution Suppose m (m + 1) = 7n 2, m and n are integers since m and m + 1are relatively prime.
m and m + 1 must be the numbers 7p 2, q 2
(in some order) p and q are relatively prime and pq = n; Since the product of 2
consecutive integer is even.
m(m + 1) is even, which means that one of the numbers m, m + 1 must be even.
Suppose m = q 2 (so that m + 1 = 7p 2 ). Since every square number is of one of the
forms 4k , 4k + 1. Consequently m + 1 must be of one of the forms 4k + 1, 4k + 2.
However this is not possible for if p is even, then 7p 2 is of the form 4k. If p is odd,
then 7p 2 is of the form 4k + 3.
m + 1 7p 2. So m = 7p 2 and m + 1 = q 2
Reason
[If all the variables are considered to be odd, then maximum remainder which can come out is 14 and if
any of the variable is an even number then remainder will be less than 14.]
Now, let us consider another discussion.
If we have a 2 + b 2 + c 2 = a 2b 2
we know, ( 2n )2 0 mod 4 and ( 2n + 1)2 1 mod 4
38 Indian National Mathematics Olympiad
e.g., x 2 + y2 = 4
Here, 4 = 4(1)
and 1 = 12 + 02
which gives i = 1 and j = 0
So, it implies there are 2 integral solutions, which are of the form 2i and 2j also we have 4 ordered pairs.
Therefore in this case the solutions are
( 2, 0), (2, 0), (0, 2) and (0, 2).
e.g., x 2 + y 2 = 24
Here, 24 = 4 6
and 6 can't be represented as i 2 + j 2 so it will not have any integral solution.
e.g., x 2 + y 2 = 12
Here, 12 = 4 3
and 3 again can't be expressed as i 2 + j 2 so it will also not have any integral solution.
Now, considering k = 4m + 2 and if m can be written as (i 2 + j 2 + i + j ) and if i j , then these will be
4 integers and 8 ordered pairs of solutions.
And if i = j , then there will be 2 integers and 4 ordered pairs of solutions.
e.g., x 2 + y 2 = 10
Here, 10 = 4 ( 2) + 2
and 2 = (1)2 + (0)2 + (1) + (0)
Therefore there will be four integral solutions which will be given as (2i + 1) and (2 j + 1) and in this
case the solutions are 3 and 1 which will give eight ordered pairs as (3, 1), (3, 1), (3, 1) and (3, 1)
also (1, 3), (1, 3), (1, 3) and (1, 3).
e.g., x 2 + y2 = 2
Here, 2 = 4 (0) + 2
and 0 = (0)2 + (0)2 + (0) + (0)
Therefore there are only two integral solutions which will again be given as ( 2i + 1) and ( 2 j + 1)
and in this case the solutions are 1 and 1, which will give four ordered pairs as (1, 1), (1, 1), (1, 1) and
(1, 1).
e.g., x 2 + y 2 = 18
Here, 18 = 4 (4) + 2
and 4 = (1)2 + (1)2 + (1) + (1)
So i = 1 and j = 1
i = j
Therefore it will have 2 integral solutions which will be given as ( 2i + 1) and ( 2 j + 1) and in this case
the solutions are 3 and 3 which gives four ordered pairs as
( 3, 3), ( 3, 3), (3, 3) and (3, 3)
e.g., x 2 + y 2 = 14
Here, 14 = 4 (3) + 2
and 3 can't be expressed as (i 2 + j 2 + i + j ) as it is always an even number and an even number can't be
equal to an odd number. So it implies if right hand side is (4m + 2) and m is an odd number. So the
equation will never produce any integral solution.
Now, we will extend this concept for an odd number in right hand side of the equation.
40 Indian National Mathematics Olympiad
x 2 + y2 = k
i.e., k = 4m + 1
or k = 4m + 3
As it has been already discussed (k = 4m + 3) will not produce any integral solutions.
So, considering k = 4m + 1, only.
If m = i 2 + j 2 + j,
then there will be an odd integer and an even integer, if i 0 and j 0 or i 0 and j = 0 , then there are
four integers and 8 ordered pairs which will satisfy the equation.
So, one of the integral solution is 2i and other is ( 2 j + 1).
Now, if i = 0, j 0, then there are two integers and four ordered pairs which will satisfy the equations.
So, one of the integral solution is 0 and other is ( 2 j + 1) .
e.g., x 2 + y 2 = 21
Here, 21 = 4 5 + 1
But 5 cannot be written as i 2 + j 2 + j , so it will not give any integral solution.
Exceptional case :
If x 2 + y2 = k
and k is an odd and a perfect square, then perform the following test always.
Take square root of k, which will come out to be as k, now subtract 1 from it we get ( k 1) always
double it, so it becomes 2( k 1), now add 1 to it which becomes 2( k 1). If this value is a perfect
square say, it is a 2 , then the equation will always have 6 integers and 12 ordered pairs as its solutions
and the integers will be a , ( k 1), k and 0. Always keep this thing in mind k is an integer.
And if the test fails, then equation will be solved by the method discussed earlier.
e.g., x 2 + y 2 = 169
here 169 = 4(42) + 1, which is of the form (4m + 1) and also it is an odd perfect square so we will have to
perform the mentioned test.
e.g., 169 = 13
13 1 = 12
12 2 = 24
24 + 1 = 25
and 25 = 52
we will have 4 integers in which 5, 12, will form 8 ordered pairs (5, 12), (5, 12), (5, 12), (5, 12), (12, 5),
(12, 5), (12, 5), (12, 5) also there will be three 13, 0 which will form four pairs (13, 0),(13, 0), (0, 13),
(0, 13)
e.g., x 2 + y 2 = 49
here 49 = 4 12 + 1, which is of the form (4m + 1) and also an odd perfect, so we will again perform the
mentioned test.
49 = 7
71= 6
6 2 = 12
12 + 1 = 13
but 13 is not a perfect square therefore the solution will be checked by the earlier method.
12 = (0)2 + (3)2 + (3)
Here, i = 0 and j = 3
so the solutions will be 0 and 7. Also the ordered pairs will be (0, 7), (0, 7), (7, 0) and (7, 0)
Theory of Numbers 41
Let p (x ) = x 3 x
B C
2k
For x > 1 we use induction
p(2) = 8 2 = 6 , p(2) is true
Let p (x ) be true for n = m
p (m ) = m3 m = 3c
p (m + 1) = (m + 1)3 (m + 1)
= (m + 1)3 (m + 1) = m3 + 3m 2 + 2m
= 3c + m + 3m 2 + 2m = 3(c + m + m 2 )
P (m + 1) is true.
Concept The radius of the circumcircle of a formed by pythogorean A
triplet cannot be integer.
The hypotenuse of the ABC is the diameter of the circle.
Let us consider the pythogorean triplet x 2 1, 2x , x 2 + 1
Here x 2 + 1 is hypotenuse. Since x is an even number its square is also even,
therefore an even number plus one is an odd number.
x 2 + 1 is an odd number B C
x2 + 1
Radius of circumcircle is
2
Concept For any natural number x for
x = 0, 1, 2, ... , n
2n + 1, 2x (22x 2x 1), 2x (22n 2x
+ 1)
2n 2x
AC = [2 (2
2 x
+ 1)]
2
42 Indian National Mathematics Olympiad
4x 2x + 1
= 22x (24n + 22n + 1) C
4 x + 2x
= (24n + 22n 2x + 1 + 2x + 22x )
2x +1
AC 2 = (24n + 22n + 2 2x )
2x +1 2
2x(22n2x + 1) 2x + 1
AB 2 + BC 2 = [22x (22n 1)2 ] + (2n )
4x 2x + 2
= 22x (24n 2 22n + 1) + 22n
2x
= 2 4n + 22x + 22n 22 22n 2
2x A 2x (22n2x 1) B
= 2 4n + 22x + 4 22n 22
. 2n
2x
= 2 4n + 22x + 22
. 2n
2x +1
= 2 4n + 22x + 22n
Example 1 Prove that there are no natural numbers, which are solutions of15x 2 7y 2 = 9.
Solution 15x 2 9 = 7y 2
3( 5x 2 3) = 7y 2
7y 2 is a multiple of 3.
y is a multiple of 3.
Let y = 3z
3( 5x 2 3) = 7 9z 2
5x 2 3 = 21z 2
5x 2 = 21z 2 + 3
5x 2 is a multiple of 3.
x is a multiple of 3
Let x = 3u
15u 2 = 1 + 7z 2
15u 6z 2 = 1 + z 2
2
1 + z 2 is a multiple of 3.
But for any z between 0 to 9, 1 + z 2 is not a multiple of 3.
For any z, the given equation has no integral solution.
Aliter
Since RHS is odd, x and y must be opposite
i.e., one even and one odd.
As 3|15 and 3|9
3 must divide 7y 2.
15x 12 = 7y12 + 1
Theory of Numbers 43
7x 2 3 = 30y12
7x 2 = 3 + 30y12 7x 2 = 3 (1 + 10y12 )
7x 2 is a multiple of 3
So, x is multiple of 3.
Let x = 3x1
7 9x12 = 3 (1 + 10y12 )
21 x12 = 1 + 10y12
21 x12 9y12 = 1 + y12
3 (7x12 3y12 ) = 1 + y12
1 + y12 is a multiple of 3.
But 1 + y12 is not a multiple of 3.
The given equation has no integral solution.
Note Every integer m can be written in the form x 2 + y 2 5z 2.
If m = 2n, then
= 2n = (n 2)2 + ( 2n 1)2 5(n 1)2
If m = 2n + 1 = (n + 1)2 + ( 2n )2 5n 2
Verification,
7 = 2( 3) + 1 = ( 3 + 1)2 + ( 2 3)2 5( 3)2
= 16 + 36 45
= 52 45 = 7
Similarly, every integer can be written in the form of
x 2 + y 2 + z 2 5u 2
44 Indian National Mathematics Olympiad
1 2n
Example 4 Prove Cn is an integer.
n +1
Example 7 Find the number of solutions in positive integers of the equation 3x + 5y = 1008.
Solution Let x , y N such that 3x + 5y = 1008 then 3 | 5y 3|y y = 3k for some k N
Now, 3x + 15k = 1008
x + 5k = 336
5k 335
k 67
Thus, any solution pair is given by ( x , y ) = ( 336 5k , 3k ) where 1 k 67.
Number of solutions is 67.
Example 11 For n N, let s(n) denote the number of ordered pairs ( x , y ) of positive integers for
1 1 1
+ = . Determine the set of positive integers n for which s(n ) = 5 .
which
x y n
1 1 1
Solution + = x, y > n
x y n
x = n + a and n + b, a, b N.
1 1 1
Now, + =
n+a n+b n
(n + b + n + a )n = (n + a )(n + b )
n 2 = ab
s(n ) is the number of divisors of n 2
Let n = p1 1 K pmm be prime factorization of n where 1 K m .
Then s(n ) = (1 + 2 1) K (1 + 2 m )
s(n ) = 5
1 + 2 1 = 5
and m =1
n = p12
Required set is {p 2 : p is prime}.
1 1 1
Example 12 If + = ;a, b, c are positive integers with no common factors. Prove that (a + b ) is a
a b c
square.
a+b 1
Solution By the hypothesis =
ab c
i.e., (a + b )c = ab
Let p be any prime which divides (a + b ); then p divides one of a, b and therefore
both.
Since gcd (a, b, c ) = 1; p does not divide c.
for any k N, pk | a pk | b
Hence the maximum power of p which divides a + b is the square of the maximum
power of p which divides a.
a + b is a square.
Theory of Numbers 47
3n 5
Example 13 Find all integers n such that is also an integer.
n +1
3n 5 8
Solution Since, = 3 is an integer.
n +1 n +1
8
{ 1, 2, 4, 8}
n +1
8
and 3 is a square.
n +1
8
Consequently = 1 or 2 ;
n +1
i.e., n = 9 or 3