Skip to content

Instantly share code, notes, and snippets.

@mstahl
Created June 5, 2010 01:02
Show Gist options
  • Save mstahl/426162 to your computer and use it in GitHub Desktop.
Save mstahl/426162 to your computer and use it in GitHub Desktop.
modulus = 14 ^ 8
(.^^.) :: Integer -> Integer -> Integer
a .^^. 1 = a
a .^^. (k + 1) = powMod modulus a (a .^^. k)
main :: IO ()
main = do mapM_ print [2731 .^^. n | n <- [1..15]]
-- Has the following output:
-- 2731
-- 120858291
-- 224021715
-- 1149386323
-- 1295674451
-- 301775699
-- 934256723
-- 934256723
-- 934256723
-- 934256723
-- 934256723
-- 934256723
-- 934256723
-- 934256723
-- 934256723
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment