Given three consecutive even numbers. Prove mathematically that atleast one of them is divisible by 6.

Examples:

Input : {2, 4, 6} Output : 6 is divisible by 6 Input : {8, 10, 12} Output : 12 is divisible by 6

**Question Source :** Amazon interview experience | Set 383 (On-Campus for Internship)

If you see the any three consecutive numbers, you can figure out atleast one of them is divisible by 6.

We can use mathematical induction for proving it mathematically.

For a number to be divisible by 6, it should be divisible by 2 and 3.

Since all are even numbers, the number will be divisible by 2.

For checking divisibility of number by 3,

Consider below proof :

Consider 3 consecutive even numbers : P(i) = {i, i+2, i+4} (i is divisible by 2) If one of these three numbers is divisible by 3, then their multiplication must be divisible by 3 Base case : i = 2 {2, 4, 6} Multiplication = (2*4*6) = 3*(2*4*2) So, it is divisible by 3 For i = n P(n) = {n, n+2, n+4} multiplication = (n*(n+2)*(n+4)) since P(n) is divisible by 3 means P(n) = n*(n+2)*(n+4) = 3k for positive number k If the statement holds for i = n, it should hold for next consecutive even number i.e. i = n + 2 P(n+2) = (n+2)*(n+4)*(n+6) It can be written as P(n+2) = n*(n+2)*(n+4) + 6*(n+2)*(n+4) P(n+2) = P(n) + 6*x where x = (n+2)*(n+4) So, P(n+2) = 3*k + 6*x both the summation elements of P(n+2) are divisible by 3, so P(n+2) is divisible by 3 Hence, there is atleast one number among three even consecutive numbers which is divisible by 6.

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

## leave a comment

## 0 Comments