# 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.

## Recommended Posts:

- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
- Count numbers which are divisible by all the numbers from 2 to 10
- Expressing factorial n as sum of consecutive numbers
- Express a number as sum of consecutive numbers
- 1 to n bit numbers with no consecutive 1s in binary representation.
- Fibbinary Numbers (No consecutive 1s in binary)
- Find the number of consecutive zero at the end after multiplying n numbers
- Check if a number can be expressed as a sum of consecutive numbers
- Find the prime numbers which can written as sum of most consecutive primes
- Count ways to express a number as sum of consecutive numbers
- Sum of numbers from 1 to N which are divisible by 3 or 4
- Generate a list of n consecutive composite numbers (An interesting method)
- Sum of all numbers divisible by 6 in a given range
- Sum of the numbers upto N that are divisible by 2 or 5
- Divisible by 37 for large numbers