Given a series (2,3,4,5,6,8,9,10,12,15,...) where the elements are in multiple of 2,3 and 5. Find the nth element of this sequence
Problem:
Assume given sequence :
2,3,4,5,6,8,9,10,12,15…
All these numbers are multiples of either 2 , 3, or 5 (and no other numbers).
Find the nth element of this sequence. (This is the interview question in flipkart)
Solution:
This can be thought in recursive terms. But to begin with, we can clearly see, 2.5=10 is part of series, but 2.7=14 is not part of series. So, while generation of numbers we have to make sure that divisor is not part of numbers like 7,11,13 etc.
[Read More]