Duck, Duck, Josephus

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  

Haskell, 54 50 48 bytes

f[x]=x
f(x:r)=f$snd<$>zip r(drop(x+1)$cycle$x:r)

Try it online!

Explanation:

  • f[x]=x: If the given list is a singleton list, return its element.
  • f(x:r)=f$ ...: Otherwise recursively apply f to the following list:
    • The elements of the current list cycled infinitely (cycle$x:r),
    • with the first x+1 elements removed (drop(x+1)$),
    • and truncated to length of r. (snd<$>zip r is a shorter alternative to take(length r)).

Previous 54 byte version:

f=(%)=<<head
_%[x]=x
n%(x:r)|n<1=f r|s<-r++[x]=(n-1)%s

Try it online!


Ruby, 37 bytes

->r{r.rotate!(r[0]).shift while r[1]}

Modifies the array in-place, which appears to be acceptable as output. Try it online!