Gyan Room  Number Theory  Concepts & Shortcuts

Writing A Number As Sum Of Two Or More Consecutive Positive Integers
In how many ways can 2010 be written as sum of two or more than two consecutive positive integers?
For example: 2010 = 669 + 670 + 671.
Now every number can be written as a sum of consecutive integers.
Ex (3) + (2) + (1) + 0 + 1 + 2 + 3 + 4 = 4
But not all numbers can be written as sum of consecutive positive integers.
A number can be written as the sum of consecutive positive integers if, and only if, its prime factorization includes an odd prime factor; then, since 2 is the only even prime number, the conclusion is that the powers of 2 are the only numbers that cannot be written as the sum of consecutive positive integers.
Number of ways to write a natural number, N as sum of two or more than two consecutive positive integers is given by number of odd positive integral divisors of N  1.
So in this particular question, number of odd divisors of 2010 is 8. hence the required number of ways = 7.
Now take an example of 36.
now 36  1 = 35 has four positive odd integral divisors. So 36 can be expressed as sum of two or more positive consecutive integers in four possible ways. But how to construe those ways if the number is large?
Ex 60; 60  1 = 59; 59 has two odd divisors, but the number of ways to express 60 as sum of consecutive positive integers is three:
60 = 19 + 20 + 21 = 10 + 11 + 12 + 13 + 14 = 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11
Also in how many ways can any natural number be expressed as sum of consecutive positive even integers or consecutive possible odd integers?
Number of ways to write a natural number,N as sum of two or more than two consecutive natural numbers = (number of odd divisors of N)  1.
If N = 36, then the required number of ways are = 3  1 = 2.
If N = 60, then required number of ways are = 4  1 = 3.Now if question is to find the number of ways to write a natural number, N as sum of two or more than two consecutive even natural numbers, then first condition is that n must be an even number. Number of ways remains same as above. Let's check for 60.
60 = 3 * 20 = 5 * 12 = 4 * 15
So, 60 = 18 + 20 + 22 = 8 + 10 + 12 + 14 + 16 = 12 + 14 + 16 + 18.Now if question is to find number of ways to write a natural number,N as sum of two or more than two consecutive odd natural numbers, then N has to be an odd number or a multiple of 4. Number of ways can be calculated accordingly.

NUMBER OF WAYS OF EXPRESSING A COMPOSITE NUMBER AS A PRODUCT OF TWO FACTORS
Let us consider an example of small composite number say, 90
Then 90 = 1 × 90
Or = 2 × 45
Or = 3 × 30
Or = 5 × 18
Or = 6 × 15
Or = 9 × 10So it is clear that the number of ways of expressing a composite no. as a product of two factors =1/2 × the number of total factors
Example: Find the number of ways of expressing 180 as a product of two factors.
Solution: 180 =2^2×3^2×5^1
Number of factors = (2+1)(2+1)(1+1)=18
Hence, there are total 18/2=9 ways in which 180 can be expressed as a product of two factors.Perfect Squares: As you know when you express any perfect square number 'N' as a product of two factors as √N x √N, and you also know that since in this case √N appears two times but it is considered only once while calculating the no. of factors so we get an odd number as number of factors so we can not divide the odd number exactly by 2 as in the above formula. So if we have to consider these two same factors then we find the number of ways of expressing N as a product of two factors=((Number of factors+1))/2 .
Perfect Squares as product if 2 distinct factors: Again if it is asked that find the no. Of ways of expressing N as a product of two distinct factors then we do not consider 1 way (i.e.,N=√N×√N) then no. Of ways = (Number of factors1)/2
Example: Find the number of ways of expressing 36 as a product of two factors.
Solution: 36 =2^2×3^2
Number of factors = (2+1)(2+1)=9
Hence the no. Of ways of expressing 36 as product of two factors = (9+1)/2=5.
As 36=1×36,2×18,3×12,4×9 and 6×6Example: In how many of ways can 576 be expressed as the product of two distinct factors?
Solution: 576 =2^6 × 3^2
∴ Total number of factors = (6+1)(2+1)=21
So the number of ways of expressing 576 as a product of two distinct factors = (211)/2 = 10.
Note since the word ‘distinct’ has been used therefore we do not include 576 = 26 × 26.

Finding the Last Digit
Last digit of any number raised to a power is decided by the last digit of the base
For example last digit of 5763^67 is same as the last digit of 3^67
So we just need to know the concept of last digit for single digit numberNow for single digit numbers, the whole thing can be divided in 3 categories
0, 1, 5, 6: last digit is always same, raised to any power.
Example 5^113 will end in 5’
6^239 will end in 6
2346 ^ 5732 will end in 64, 9: Here there is a cycle of 2;
For 4 it is 4 and 6 and for 9 it is 9 and 1
So odd powers of 4 will end in 4 and even power in 6
Odd powers of 9 will end in 9 and even power in 1
Example:
564 ^ 231 will end in 4
75689 ^ 568 will end in 12, 3, 7 and 8
Here there is a cycle of 4
Divide the power by 4 and take the remainder as the power
For example: last digit of 2347 ^2347 is same as 7^2347
Divide the power by and take the remainder; to find the remainder on dividing by 4, we just need to take the last 2 digits
So last digit of 2347^2347 is same as 7^47
Divide 47 with 4; remainder is 3
So last digits is same as that of 7^3 = 3
Example: 5748 ^5748
Same as 8^48
On dividing 48 with 4 the remainder is 0
When the remainder is 0, we take it as 4
So 8^4; last digit is 6
Find the last digit of : (101^101 + 102^102……109^109)
101^101: 1
102^102: 2^2 : 4
103^103: 3*3: 7
104^104: 6
105^105: 5
106^106:6
107:107:7^3: 3
108^108: 8^4: 6
109^109: 9
Last digit: 7
So , 1 4 7 6 5 6 3 6 9 adds up to 47 so last digit is 7Find the last digit of 3^(2^2^2….)
We know that is the base is 3, we need to divide the power by 4 and take the remainder
Now when you divide a number with 4, possible remainders are 1, 2, 3 and 0
Remainder of 3 can also be taken as remainder of 1; for example 19 divide by 4 is 4x4+3 (remainder 3) but it can also be written as 4x51 (remainder 1)
Remainder of 2 will only be there when the given power is even. Any even power raised to any number when divided by 4 will give the remainder as 0
Remainder of 0 will be taken as 4; for finding the last digit
So when we divide (2^2^2..) with 4, the remainder is 0
Any even digit ^ any number will always be divisible by 4
So the last digit of 3^(2^2^2….) is same as 3^4 = 1Find the last digit of (1002 ^ 1003 ^ 1004…..2000)
1002 ^ 1003 ^ 1004…..2000)
(2 ^ 1003 ^ 1004…..2000)
2 ^ ( (1) ^1004…..2000)
1^even number = 1
2^ (1^…..) = 2Find the last digit of: 2468^ (4682^6824^8246)
8^(2^even number..)
8^4 = 6
So 6

Finding the second last digit
Cyclicity
There lies the cyclicity of tens' place digit of all the digits. This is given below:
Digits Cyclicity 2, 3, 8 20 4, 9 10 5 1 6 5 7 4 Example 2367^2367
Take 7^2366; this will be same as 7^2 (as 7 has a cyclicity of 4 so we divide the power with 4)
7^2 = 49
Now, Multiply the 2nd last digit of the given number with the last digit of power and place the last digit of the original number in the last place
Last digit of 6 x 7 = 2
So 27
Now multiply 27 with 49; last 2 digits are 23Example 3438 ^ 126
8 has a cyclicity of 20, so 8^6
8^3: 12
So 8^6: 44
Last digit of 3 x 6 = 8; so 88
44 x 88 = 16SHORT CUT FOR LAST 2 DIGITS OF NUMBERS ENDING WITH 1:
EXAMPLE: 2341 ^ 678
Multiply the 2nd last digit of base with last digit of the power: 4 x 8 = 32
Last digit was 2
So last digit of overall expression is 21

Algebraic representation of numbers
Representing numbers in algebraic form is very useful while we chase X. Sharing some useful Fundas
Consecutive numbers: n, n+1, n+2 …
Even number: 2n
Consecutive even numbers: 2n, 2n+2, 2n+4 …
Odd number: 2n+1
Consecutive Odd numbers: 2n+1, 2n+3, 2n+5 …
2 digit number (say ab) = 10a + b (a and b can take values from 0 to 9)
3 digit number (say abc) = 100a + 10b + c
n digit number =10^{(n1)}digit_{1}+ 10^{(n2)}digit_{2}+… + digit_{n }(Digits taken left to right)
Three consecutive numbers: n1, n, n+1 (sums to zero)
(a + b)^{2}= a^{2}+ 2ab + b^{2}
(a  b)^{2}= a^{2} 2ab + b^{2}
(a + b)(a  b) = a^{2} b^{2}
a^{3}+ b^{3}= (a + b) (a^{2} ab + b^{2})
a^{3} b^{3}= (a  b) (a^{2}+ ab + b^{2})
(a + b)^{3}= a^{3}+ 3a^{2}b+ 3ab^{2}+ b^{3}
(a  b)^{3}= a^{3} 3a^{2}b+ 3ab^{2} b^{3}
(a + b + c)^{2}= a^{2}+ b^{2}+ c^{2}+ 2ab + 2bc + 2ca
(a + b + c) (a^{2}+ b^{2}+ c^{2} ab  bc  ca) = a^{3}+ b^{3}+ c^{3} 3abc
a^{3}+ b^{3}+ c^{3}= 3abc, if a + b + c = 0
a^{0}= 1
a^{1}= a
a^{m}× a^{n}= a ^{(m + n)}
a^{m}/ a^{n}= a ^{( m – n )}
(a^{m})^{n}= a^{m.n}
a^{ m}= 1 / a^{m }
(ab)^{m}= a^{m}b^{m}
Symbol √ is called as radical sign or radix.
Need a case to solve? Here we go…
When you reverse the digits of the number 13, the number increases by 18. How many other two digit numbers increase by 18 when their digits are reversed? (CAT 2006)
Here we are not just asked to find X but the whole X Gang! What are the clues?
1. X Gang contains only two digit numbers
2. If X Gang members are reversed they are increased by 18 than the original value.
We can write any 2 digit number xy as 10x + y (x and y are the first and second digit).
After reversing the number is yx represented as 10y + x.
Given 10y + x = 10 x + y + 18, solving y = x + 2. y should be 2 more than x.
Now y cannot be 2 as then x = 0 and the number 02 is not a 2 digit number!
y can take values from 3 to 9
when y = 3, x = 3 – 2 =1; y=4, x = 4 – 2 = 2; and so on…
Our gang is (10x + y) for all the above (x, y) which are 13, 24, 35, 46, 57, 68 and 79.Gang busted! :)

Divide and Conquer
We will now learn an interesting and equally important concept, divisibility of numbers. These concepts will be used extensively during prime factorization and while calculating HCF/LCM. Here we will just focus on how we can easily check whether a given number is divisible by some common divisors or not.
Divisible by 2: If the last digit is divisible by 2.
12, 142, 68…Divisible by 3: Sum of digits of the number is divisible by 3.
15672, sum of digits = 1+5+6+7+2 = 21 = 3 * 7, hence divisible by 3.Divisible by 4: If the last 2 digits are divisible by 4.
724, Last 2 digits (24) gives a number divisible by 4.Divisible by 5: If the last digit is 5 or 0.
E.g. 625, 310 etc…Divisible by 7: Subtract twice the unit digit from the remaining number.
If the result is divisible by 7, the original number is.
14238, 2 * 8 – 1423 = 1407 = 201 * 7, hence divisible by 7Divisible by 8: If the last 3 digits are divisible by 8.
1040, Last 3 digits (040) gives a number divisible by 8.
A number is divisible by 2^{n}if the last n digits are divisible by 2^{n}.Divisible by 9: If the sum of the digits is divisible by 9
972036, sum of the digits = 9 + 7 + 2 + 0 + 3 + 6 = 27, divisible by 9.Divisible by 11: If the difference between the sum of digits at the odd place and the sum of digits at the even place is zero or divisible by 11.
1639, (9+6)  (3+1) = 11, divisible by 11.Divisible by 13: If the difference of the number of its thousands and the remainder of its division by 1000 is divisible by 13.
2184, 2  184 = 182, so divisible by 13.Divisible by 33, 333, 3333… & 99, 999, 9999…:
As a general rule, to check a given number is divisible by 333…3 (n digits) just see whether the sum of digits taken n at a time from right is divisible by 333…3 (n digits). If yes then the original number is also divisible by 33…3 (n digits). It is easy to understand through examples.
Is 627 divisible by 33?
Take 2 digits from right at a time, and get the sum.
27 + 06 = 33, hence divisible by 33Is 22977 divisible by 333?
Take 3 digits from right at a time and find the sum.
977 + 022 = 999, hence divisible by 333Same can be applied for checking the divisibility of a given number with 99…9 (n digits). Check if the sum of digits taken n at a time from right is divisible by 999…9 (n digits). If yes then the original number is also divisible by 99…9 (n digits)
Is 6435 divisible by 99?
35 + 64 = 99. As per the above rule, 6435 is divisible by 99.How much time you need to tell whether the number 1000000998 is divisible by 999?

Approximate
Wherever possible, approximate. Most of the times we don’t need precision level more than 2 decimal points to uniquely differentiate the given options. If the question demands more precision than that, leave the question and come back if you have time.
As we discussed earlier, an easy approximation technique is to write numerator with respect to denominator
2136 / 17 =
2136 ≈ 1700 (100 * 17) + 340 (20 * 17) + 85 (17 * 05) + 8.5 (17 * 0.5) + 1.7 (17 * 0.1) …
2136 / 17 ≈ 100 + 20 + 5 + 0.5 + 0.1 +… ≈ 125.6 ( Actual value is 125.64 )There are various approximation techniques which are discussed and debated at multiple forums. But I feel most of them are complicated considering the level of approximation we need. Stick with methods that are simple to understand and easy to apply. I am not sure, but many approximation techniques are some where related to the aforementioned method. If you know some methods which are useful in approximation, do share.
Use Options
Number S is equal to the square of the sum of the digits of a 2 digit number D. If the difference between Sand D is 27, then D is (CAT 2002)
(1) 32
(2) 54
(3) 64
(4) 52Here we can form the algebraic equation and solve… but easiest way is to take options one by one and see which option satisfies the given condition.
Option1: 32, S – D = (3 + 2)^{2}– 32 = 7, Not the answer.
Option2: 54, S – D = (5 + 4)^{2}– 54 = 27… Oila!!! :)Options are not just useful in substitution, but will also help us in deduction also.
‘Solving’ this equation will take us ages. We can write the above question as
Options can be written as
(1) (n+1) – 1/ (n+1)
(2) n – 1/n
(3) n – 1/ (n+1)
(4) (n+1) – 1/n
(5) (n+1) – 1/ (n+2)For n =1, sum is √ (2+1/4) = √9/4 = 3/2
Now substitute n=1 in the options
1) 2 – 1/2 = 3/2
2) 1 – 1/1 = 0
3) 1 1/2 = 1/2
4) 2 1/1 = 1
5) 2 – 1/3 = 5/2
Only option 1 satisfies. This holds true for any value of n. Coming back to the original question where n = 2007, sum should be equal to (n+1) – 1/ (n+1) = 2008 – 1/2008.

In how many equal parts should you divide 100 so that the continued product of those equal parts will be maximum?
Formula: N =floor (Sum/e)
where e is the Euler’s constant approximately equal to 2.71828
Floor function means the greatest integer less than or equal to
Solution:
N = floor (100/e) ~ 36
N = 36

How to find two numbers given that their sum is S and product of x^a and y^b is to be maximized.
Formula: X = S * a / ( a + b )
Y = S * a / ( a + b)Example: Find 2 positive numbers such that their sum is 20 and the product of the cube of the first and the square of the second number is to be maximized.
Solution:
Product = x^3 y^2
Applying the formula above, we will get the following values below:
X = 20 * 3 / ( 3 + 2 ) = 12
Y = 20 * 2 ( 3 + 2 ) = 8
The numbers required are 12 and 8.

In scenarios like finding distinct values of [x^2/n] where x can be from 1, 2, 3 ... n
[1^2/n], [2^2/n] ... [(n/2)^2/n] will yield all numbers from 0 to [n/4] (means [n/4] + 1 distinct integers)
Then the next set (from [(n/2 + 1)^2/n] till [n^2/n] will be all different integers (means [n/2] distinct integers)
So the number of distinct integers would be [n/2] + [n/4] + 1
if n = 100,
number of distinct integers would be [100/2] + [100/4] + 1 = 76if n = 2014,
number of distinct integers would be [2014/2] + [2014/4] + 1 = 1511if n = 13
number of distinct integers would be [13/2] + [13/4] + 1 = 10Just trying to generalize a solution shared by Kamal Lohia sir.

Kaprekar's constant
6174 is known as Kaprekar's constant.
 Take any fourdigit number, using at least two different digits. (Leading zeros are allowed.)
 Arrange the digits in descending and then in ascending order to get two fourdigit numbers, adding leading zeros if necessary.
 Subtract the smaller number from the bigger number.
 Go back to step 2 and repeat.
The above process will always yield 6174, in at most 7 iterations. The only fourdigit numbers for which Kaprekar's routine does not reach 6174 are repdigits such as 1111, which give the result 0000 after a single iteration.