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.