Duck, Duck, Josephus Given an Integer array:


Start from the first number
Jump forward n positions where n is the value of the current position
Delete the current position, making what was the next position the current position.
Goto step 2 until there is one number remaining
Print that number


Rules

The array wraps-around (the next number after the last number in the array is the first number).

A zero removes itself (Obviously).

Negative numbers are not allowed as input.

Test Cases

[1] =&gt; 1
[1,2] =&gt; 1
[1,2,3] =&gt; 3
[1,2,2] =&gt; 1
[1,2,3,4] =&gt; 1
[6,2,3,4] =&gt; 4
[1,2,3,4,5] =&gt; 5
[0,1] =&gt; 1
[0,0,2,0,0] =&gt; 0




Step-by-step example

[1,4,2,3,5]
 ^          start from the first position
   ^        jump 1 position (value of the position)
[1,  2,3,5] remove number in that position
     ^      take next position of the removed number (the 'new' 'current' position)
         ^  jump 2 positions
[1,  2,3  ] remove number in that position
 ^          take next position (looping on the end of the array)
     ^      jump 1 position
[1,    3  ] remove number in that position
       ^    take next position (looping)
 ^          jump 3 positions (looping on the end of the array)
[      3  ] remove number in that position
print 3


Example #2

[4,3,2,1,6,3]
 ^            start from the first position
         ^    jump 4 positions
[4,3,2,1,  3] remove number in that position    
           ^  take next position
     ^        jump 3 positions
[4,3,  1,  3] remove number in that position    
       ^      take next position
           ^  jump 1 positions
[4,3,  1    ] remove number in that position    
 ^            take next position
   ^          jump 4 positions
[4,    1    ] remove number in that position    
       ^      take next position
 ^            jump 1 position
[      1    ] remove number in that position
print 1


This is code-golf, the shortest answer in bytes wins!
Husk, 7 bytes
This returns the result as a singleton list
ΩεSotṙ←

Try it online!
Explanation
Ω               Until
 ε              the result is a singleton list
     ṙ          Rotate left by
  S   ←         the first element
   ot           Then remove the first element