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.

## Recommended Posts:

- Permutation of numbers such that sum of two consecutive numbers is a perfect square
- Rearrange a string so that all same characters become atleast d distance away
- Find minimum radius such that atleast k point lie inside the circle
- Fibbinary Numbers (No consecutive 1s in binary)
- 1 to n bit numbers with no consecutive 1s in binary representation.
- Express a number as sum of consecutive numbers
- 1 to n bit numbers with no consecutive 1s in binary representation
- Consecutive sequenced numbers in a string
- Print all possible sums of consecutive numbers with sum N
- Expressing factorial n as sum of consecutive numbers
- Check if a number can be expressed as a sum of consecutive numbers
- Maximum consecutive numbers present in an array
- Fibbinary Numbers (No consecutive 1s in binary) - O(1) Approach
- Find the number of consecutive zero at the end after multiplying n numbers
- Count ways to express a number as sum of consecutive numbers