Advertisement
Guest User

snowbeard

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