Please suggest a good algo for this :
You have numbers 1 to n (consider them arranged in a circular order)
Then starting from the first number, all alternate numbers are deleted. Once
the entire range is traversed with this procedure, the same is performed
from the beginning again (as they are
All the numbers from 1 to infinity are written in sequence:
1,2,3,4,5,6,7,8,9,10,11,12,13,14.
in the first iteration, every second number is removed, leaving:
1,3,5,7,9,11,13
in the second iteration, every third number in the above sequence is
removed, thus leaving: 1,3,7,9,13
in the