Skip to content

Instantly share code, notes, and snippets.

@chadbrewbaker
Created May 14, 2015 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadbrewbaker/3090f5712f9c6f2b326d to your computer and use it in GitHub Desktop.
Save chadbrewbaker/3090f5712f9c6f2b326d to your computer and use it in GitHub Desktop.
First iteration of endoscope, MVP on Z_7(*)
monogenic :: Int -> Int -> (Int -> Int -> Int) -> [Int]
monogenic size seed mult = take size $ iterate f seed
where
f = mult seed
endoscope :: Int -> (Int -> Int -> Int) -> Graph
endoscope size mult = buildG (0,size) $ concat [ g i | i <- [0..size]]
where
g blar = zip (replicate size blar) (f blar)
where
f x = monogenic size x mult
mul7 :: Int -> Int -> Int
mul7 x y = mod (x*y) 7
main = print $ endoscope 7 mul7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment