In this kata you have to correctly return who is the "survivor", ie: the last element of a Josephus permutation.

Basically you have to assume that n people are put into a circle and that they are eliminated in steps of k elements, like this:

```
josephus_survivor(7,3) => means 7 people in a circle;
one every 3 is eliminated until one remains
[1,2,3,4,5,6,7] - initial sequence
[1,2,4,5,6,7] => 3 is counted out
[1,2,4,5,7] => 6 is counted out
[1,4,5,7] => 2 is counted out
[1,4,5] => 7 is counted out
[1,4] => 5 is counted out
[4] => 1 counted out, 4 is the last element - the survivor!
```

The above link about the "base" kata description will give you a more thorough insight about the origin of this kind of permutation, but basically that's all that there is to know to solve this kata.

**Notes and tips:** using the solution to the other kata to check your function may be helpful, but as much larger numbers will be used, using an array/list to compute the number of the survivor may be too slow; you may assume that both n and k will always be >=1.

Difficulty: introductory

Starter code:

def josephus_survivor(n,k):
	

Solutions:
def josephus_survivor(n, k):
    v = 0
    for i in range(1, n + 1): v = (v + k) % i
    return v + 1

def josephus_survivor(n,k):
    soldiers = [int(i) for i in range(1, n + 1)]
    counter = -1
    while len(soldiers) != 1:
        counter += k
        while counter >= len(soldiers):
            counter = abs(len(soldiers) - counter)
        soldiers.remove(soldiers[counter])
        counter -= 1
    return soldiers[0]

import sys
# Set new (higher) recursion limit
sys.setrecursionlimit(int(1e6))

# Source: https://en.wikipedia.org/wiki/Josephus_problem#The_general_case
# (I couldn't come up with the formula myself :p)
josephus_survivor = lambda n, k: 1 if n == 1 else ((josephus_survivor(n - 1, k) + k - 1) % n) + 1

def josephus_survivor(n,k):
    lst = [i for i in range(1,n+1)]
    x = k-1
    while len(lst) != 1:
        x = x % len(lst)
        lst.pop(x)
        x += k-1
    return lst[0]
    



def josephus_survivor(n,k):
    arr = [i + 1 for i in range(n)]
    if len(arr) == 1:
        return arr[0]
    cur_pos = k - 1
    while len(arr) != 1:
        while cur_pos >= len(arr):
            cur_pos = cur_pos - len(arr)
        arr.pop(cur_pos)
        cur_pos += k - 1
    return arr[0]

def josephus_survivor(n,k):
    if (n == 1): 
          return 1 
    else: 
          r = list(range(1, n+1))
          sum = 0
          for i in r:
              sum = (sum+k) % i
          return sum + 1
        
        


def josephus_survivor(n,k):
    arr = [i for i in range(1, n + 1)]
    ptr = k - 1
    while (len(arr) > 1):
        if ptr >= len(arr):
            ptr = ptr % len(arr)
        del arr[ptr]
        ptr += k - 1
    return arr[0]

def josephus_survivor(n,k):
    circle = list(range(1,n+1))
    i = 0
    while len(circle) > 1:
        i = (i - 1 + k) % len(circle)
        circle.pop(i)
    return circle[0]