I was asked this in an interview.
We have people numbered from one to infinity: $$1, 2, 3, 4, 5, 6, 7, 8, \dotsc\,.$$ In first pass every 2nd person is killed, so we have $$1, 3, 5, 7, 9, 11,\dotsc$$ remaining. In next pass every 3rd remaining person in killed. Now we have: $$1, 3, 7, 9, 13, \dotsc\,.$$ This goes on and on. Given their number in line we need to tell if the person survived.
I couldn't come up with a better than a brute force solution. I was specifically told to use programming but math based ideas are also welcome. The brute force solution was to have Boolean array of size $N$ and $\log N$ passes for all $N$ elements to mark every $k$th non marked element true. If $N$ gets marked return false else in the end return true.