6 BULLET CURVE
If N is the number of people in circle and if K is the nearest power of 2 which is less than N, then
Last Person = 2 * (N - K) + 1
#Import math Library
import math
#N People
N = 100
#Largest Power of 2 <= Total Number
M = math.log(N,2);
#If Largest Power of 2 = Total Number
if(M.is_integer()):
print('1');
#Else Largest Power of 2 < Total Number
else:
P = math.floor(M);
K = pow(2,P)
Sol = 2 * (N - K) + 1
print('Surviving Person:', Sol)
If N = 100 then output:
Surviving Person: 73
If N = 5 then output:
Surviving Person: 3