# Numbers

**TYPES OF NUMBERS**

**Integers :**All numbers whose fractional part is 0 (zero) like -3, -2, 1, 0, 10, 100 are integers.**Natural Numbers :**Counting numbers like 1, 2, 3, 4, 5, 6 … Basically, all integers greater than 0 are natural numbers.**Whole Numbers :**All natural numbers and 0 (zero) are whole numbers.**Prime Numbers :**All numbers having only two distinct factors, the number itself and 1, are called prime numbers. Some prime numbers are 2, 3, 53, 67 and 191.**Composite Number :**All numbers greater than 1 which are NOT prime are composite numbers. Some composite numbers are 4, 60, 91 and 100.

**IMPORTANT POINTS ON PRIME NUMBERS**

- 1 is neither prime, nor composite.
- 2 is the only even prime number.
- There are 25 prime numbers less than 100. They are : 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97.
- To check if a number ‘p’ is prime, find a number ‘n’ such that ‘n’ is the smallest natural number which satisfies n
^{2}>= p. Now, check if ‘p’ is divisible by any of the prime numbers less than or equal to ‘n’. If ‘p’ is NOT divisible by any such prime numbers, ‘p’ is a prime number. Otherwise, p is not a prime number. - Co-primes : Two numbers ‘a’ and ‘b’ are called co-prime if their highest common factor (HCF) is 1.

**DIVISIBILITY TESTS**

**Divisibility By 2 :**A number is divisible by 2 if the last digit is any of 0, 2, 4, 6, 8.**Divisibility By 3:**A number is divisible by 3 if the sum of its digits is divisible by 3. For example, 12321 is divisible by 3 because 1 + 2 + 3 + 2 + 1 = 9 and 9 is divisible by 3.**Divisibility By 4 :**A number is divisible by 4 if the last two digits are divisible by 4. For example, 1234 is not divisible by 4 as the last two digits 34 is not divisible by 4. But, 1232 is divisible by 4 as the last two digits 32 is divisible by 4.**Divisibility By 5 :**A number is divisible by 5 if the last digit is either 0 or 5.**Divisibility By 6 :**A number is divisible by 6 if it is divisible by both 2 and 3. For example, 114 is divisible by 6 as it is divisible by both 2(last digit is 4) and 3 (1+1+4=6, 6 is divisible by 3).**Divisibility By 7 :**A number is divisible by 7 iff repeatedly doing following steps until a single digit left leaves the single digit as 0 or 7. (1) Remove the last digit. (2) Subtract double of last digit from the number obtained after step 1 (number with last digit removed). Example, given number is 196. After removing last digit, we get 19. After subtracting 12 (double of removed digit), we get 7. Since the last left digit is 7, number is multiple of 7.**Divisibility By 8 :**A number is divisible by 8 if the last three digits are divisible by 8. For example, 1234 is not divisible by 8 as the last three digits 234 is not divisible by 8. But, 1232 is divisible by 8 as the last three digits 232 is divisible by 8.**Divisibility By 9 :**A number is divisible by 9 if the sum of its digits is divisible by 9. For example, 12321 is divisible by 3 because 1 + 2 + 3 + 2 + 1 = 9 and 9 is divisible by 9.**Divisibility By 11 :**A number is divisible by 11 if the difference between the sum of numbers at even positions and odd positions is either 0 or a multiple of 11.

**NOTE :** If ‘p’ and ‘q’ are co-primes and we have a number ‘n’ that is divisible by both ‘p’ and ‘q’, ‘n’ will be divisible by p x q.

For example, 48 is divisible by both 3 and 8 and also by 3 x 8 = 24.

But, if ‘p’ and ‘q’ are NOT co-prime, then the fact that ‘n’ would be divisible by p x q given that ‘n’ is divisible by both ‘p’ and ‘q’ is not necessary. For example, 144 is divisible by both 8 and 12 (not co-prime), but it is not divisible by 8 x 12 = 96.

**DIVISION THEOREM**

- Dividend = (Divisor x Quotient) + Remainder
- (x
^{n}– a^{n}) is divisible by (x – a) for all values of n.

For example, for n = 2, x^{2}– a^{2}= (x – a) (x + a), which is divisible by (x – a).

Similarly, for n = 3, x^{3}– a^{3}= (x – a) (x^{2}+ a^{2}+ xa), which is divisible by (x – a). - (x
^{n}– a^{n}) is divisible by (x + a) for all even values of n.

For example, for n = 2, x^{2}– a^{2}= (x – a) (x + a), which is divisible by (x+a).

Similarly, for n = 3, x^{3}– a^{3}= (x – a) (x^{2}+ a^{2}+ xa), which is not divisible by (x + a). - (x
^{n}+ a^{n}) is divisible by (x + a) for all odd values of n.

For example, for n = 3, x^{3}+ a^{3}= (x + a) (x^{2}+ a^{2}– xa), which is divisible by (x + a).

### Sample Problems

**Question 1 :** When a number is successively divided by 2, 3, 7, we get 1, 2, 3 as the remainder respectively. What is the smallest such number ?

**Solution :** The number is of the form 2a+1, 3b+2, 7c+3. So, we put c=1 and proceed as follows :

Basically, we successively multiply the divisors with the result of the previous stage and add the corresponding remainder.

7 x 1 + 3 = 10

3 x 10 + 2 = 32

2 x 32 + 1 = 65

Thus, 65 is the required answer.

**NOTE : The answer would differ if we change the order of divisors. For smallest number, arrange the divisors in decreasing order.**

**Question 2 : **When a number is successively divided by 2, 4, 8, we get 1, 1, 0 as the remainder respectively. What is the smallest such number ?

**Solution : ** Proceeding in the similar manner as the above question,

8 x 1 + 0 = 8

4 x 8 + 1 = 33

2 x 33 + 1 = 67

Thus, 67 is the required answer.

**Question 3 : **What would be the maximum value of ‘B’ in the following equation :

1 2 B + B 4 C + C 6 7 -------- 1035 --------

**Solution : ** Only the leftmost part of the number can be of two or more digits. So, we split the answer as :

1 2 B + B 4 C + C 6 7 -------- 10 3 5 --------

Now, from column 1, we can easily infer that B + C = 8.

First, let us consider B + C = 18. This is the case possible if and only if B = C = 9. So, the equation would be 129 + 949 + 967 = 2045, but we need 1035 as the answer. Thus, this is not the required case.

So, B + C = 8. For maximum ‘B’, we put C = 0. Therefore, B = 8.

Now, to verify our answer, we put B = 8 and C = 0 in the given equation.

1 2 8 + 8 4 0 + 0 6 7 -------- 10 3 5 --------

Therefore, our answer B = 8 is correct.

**Question 4 : **Which of the following are prime numbers ?

(i) 247

(ii) 397

(iii) 423

**Solution : **

(i) 16^{2} = 256 > 247. Prime numbers less than 16 are 2, 3, 5, 7, 11, 13 and 247 is divisible by 13. Therefore, 247 is not a prime number. It is a composite number.

(ii) 20^{2} = 400 > 397. Prime numbers less than 20 are 2, 3, 5, 7, 11, 13, 17, 19 but 397 is not divisible by any of these. Therefore, 397 is a prime number.

(iii) 21^{2} = 441 > 423. Prime numbers less than 21 are 2, 3, 5, 7, 11, 13, 17, 19 and 423 is divisible by 3. Therefore, 423 is not a prime number. It is a composite number.

**Question 5 : **Find the unit’s digit in the product (17)^{153} x (31)^{62}.

**Solution : ** The unit’s digit of the given equation would be the same as the unit’s digit of the equation 7^{153} x 1^{62}.

Now, we need to find a pattern in the unit’s digit when we gradually increase the powers of 7. 7^{1} gives 7, 7^{2} gives 9, 7^{3} gives 3, 7^{4} gives 1. So, at the fourth power, we get the unit’s digit as 1. Therefore, to make our work easy, we need to write the original power (153) in multiples of 4 to the closest extent possible. We multiply this power (4) by a number such that we get nearest to 153. So, 4 x 38 = 152 and 7^{152} also has 1 in the unit’s place.

Now, (17)^{153} has 7 at unit’s place and (31)^{62} has 1 at the unit’s place.

Therefore, the problem simply reduces to 7 x 1 = 7.

Hence, the unit’s digit is 7.

**Question 6 : **Find the unit’s digit in (17)^{153} + (31)^{62}.

**Solution : ** The unit’s digit of the given equation would be the same as the unit’s digit of the equation 7^{153} + 1^{62}.

Now, we need to find a pattern in the unit’s digit when we gradually increase the powers of 7. 7^{1} gives 7, 7^{2} gives 9, 7^{3} gives 3, 7^{4} gives 1. So, at the fourth power, we get the unit’s digit as 1. Therefore, to make our work easy, we need to write the original power (153) in multiples of 4 to the closest extent possible. We multiply this power (4) by a number such that we get nearest to 153. So, 4 x 38 = 152 and 7^{152} also has 1 in the unit’s place.

Now, (17)^{153} has 7 at unit’s place and (31)^{62} has 1 at the unit’s place.

Therefore, the problem simply reduces to 7 + 1 = 8.

Hence, the unit’s digit is 8.

**Question 7 : **Find the total number of prime factors in the expression (14)^{11} x (7)^{2} x (11)^{3} .

**Solution : **(14)^{11} x (7)^{2} x (11)^{3} = (2 x 7)^{11} x (7)^{2} x (11)^{3} = (2)^{11} x (7)^{11} x (7)^{2} x (11)^{3} = (2)^{11} x (7)^{13} x (11)^{3}

Therefore, total number of prime factors = 11 + 13 + 3 = 27

**Question 8 : **Which digits should come in place of * and # such that the number 12386*# is divisible by both 8 and 5 ?

**Solution : ** Since the given number should be divisible by 5, 0 or 5 must come in place of #. But, a number ending with 5 is never divisible by 8. So, 0 will replace #.

Now, the number formed by the last three digits is 6*0, which becomes divisible by 8, if * is replaced by 0 or 4 or 8.

Hence, digits in place of * and # are 0 or 4 or 8 and 0 respectively.

**Question 9 : **What is the least number that must be subtracted from 9999 to make it exactly divisible by 19 ?

**Solution : **On dividing 9999 by 19, we get 5 as remainder. Therefore, number to be subtracted = 5.

**Question 10 : ** What is the least number that must be added to 9999 to make it exactly divisible by 19 ?

**Solution : **On dividing 9999 by 19, we get 5 as remainder. Therefore, number to be added = 19 – 5 = 14.

**Question 11 :** A number when divided by 340 gives a remainder 47. What would be the remainder when the same number is divided by 17 ?

**Solution : **The number is of the form 340a + 47 = 17 * (20a) + 17 * (2) + 13 = 17 * (20a + 2) + 13.

Therefore, on dividing this number by 17, we would get 13 as the remainder.

**Question 12 : **Find the remainder when 3^{21} is divided by 5.

**Solution : **3^{4} = 81. So, the unit’s digit of 3^{4} is 1.

Therefore, the unit’s digit of 3^{20} = 1 and thus, the unit’s digit of 3^{21} = 1*3 = 3.

3 when divided by 5 gives 3 as the remainder.

So, the remainder when 3^{21} is divided by 5 is 3.

### Problem on Numbers | Set-2

### Quiz on Numbers

This article has been contributed by **Nishant Arora**

Please write comments if you have any doubts related to the topic discussed above, or you are facing difficulty in any question or if you would like to discuss a question other than those mentioned above.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- Problem on Numbers
- TCS Coding Practice Question | LCM of 2 Numbers
- TCS Coding Practice Question | HCF or GCD of 2 Numbers
- TCS Coding Practice Question | Average of 2 Numbers
- TCS Coding Practice Question | Greatest of 3 Numbers
- TCS Coding Practice Question | Swap two Numbers
- Quantitative Aptitude: Maths Tricks | Set 1 (Squares of numbers)
- TCS Coding Practice Question | Prime Numbers upto N
- Minimum count of numbers required with unit digit X that sums up to N
- Count of N-digit numbers with absolute difference of adjacent digits not exceeding K
- Count of all subsequences having adjacent elements with different parity
- Find the node at the centre of an N-ary tree
- Count of submatrix with sum X in a given Matrix
- Difference between sum of even and odd valued nodes in a Binary Tree