# Thread: Josephus problem with varying k

1. ## Josephus problem with varying k

for the condition in Josephus problem - Wikipedia when k is fixed i.e either every 2nd person OR every 3rd person is killed the general recurrence relation is :

f(n,k)=(f(n-1,k)+k)%n with f(1,k)=1
Now if there is a situation in which k increases as 1,2,3,.. then how to formulate ? E.g if there are 5 people numbered as 1,2,3,4,5 and k(position of person selected to execute) is 1 for 1st round 2 for second and so on then the position at which survivor should stand is 4
Thanks.

2. ## Re: Josephus problem with varying k

i tried out a few cases with hand and got the answers for n = 1..12 as 1,2,3,4,4,5,4,7,8,7,11,11 resp ..but i can't see any pattern..