Prove that atleast one of three consecutive even numbers is divisible by 6

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. 

This article is contributed by Mandeep Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

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



My Personal Notes arrow_drop_up

 
Practice Tags :
Article Tags :

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



1.5 Average Difficulty : 1.5/5.0
Based on 4 vote(s)






User Actions