"""
Josephus problem
circular round killing the nth person
"""

def josephus(n, k):
	if n == 1:
		return 1
	return (josephus(n - 1, k) + k-1) % n + 1;

print josephus(14, 2)
1d4381ca5111d0bd85c9f16ae81fb6a37a5bcc86
"""
Josephus problem
circular round killing the nth person
"""

def josephus(n, k):
	if n == 1:
		return 1
	return (josephus(n - 1, k) + k-1) % n + 1;

print josephus(14, 2)