I am given an integer N. I have to find first N elements that are divisible by 2,3 or 5, but not by any other prime number.
N = 3 Results: 2,3,5 N = 5 Results: 2,3,5,6,8
Mistake number = 55.. 55/5 = 11.. 11 is prime number.. so means that it divides by any other prime number and doesn't counts in..
I guess there is need of recursive function,but I cant imagine what would algorithm look like
I was sent here from stackoverflow.
They gave me advice.. 2^i*3^j*5^k
, for i,j,k = 0,1,2... , but it won't give an ordered array, because 2*2 < 2*3 .. and so on
I am trying to get this work in C++