Skip to content

Instantly share code, notes, and snippets.

@k-payl
Created October 22, 2013 05:52
Show Gist options
  • Save k-payl/7095775 to your computer and use it in GitHub Desktop.
Save k-payl/7095775 to your computer and use it in GitHub Desktop.
1.hs
gcd' :: Int -> Int -> Int
gcd' a b = if (b/=0) then gcd' b (mod a b) else a
isPrime :: Integer -> Bool
isPrime a = if a==1 then False else iter a 2
iter a n = if (n * n > a) then True else
if (mod a n)==0 then False else iter a (n+1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment