Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- josephus :: Int -> Int -> Int
- josephus n m = josephus_helper [0..(n-1)] m-1
- where josephus_helper [a] m' = a
- josephus_helper (a:as) m' | m' == 0 = josephus_helper as m-1
- | otherwise = josephus_helper (as++[a]) m'-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement