SHARE
TWEET

snowbeard

a guest Aug 13th, 2009 444 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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top