Skip to content

Instantly share code, notes, and snippets.

@cmoore
Created June 18, 2009 03:38
Show Gist options
  • Save cmoore/131680 to your computer and use it in GitHub Desktop.
Save cmoore/131680 to your computer and use it in GitHub Desktop.
gpfsearch :: ( Integral a ) => a -> a -> a
gpfsearch f x | x == f = x
| divides x f = gpfsearch f ( div x f )
| otherwise = gpfsearch ( f + 1 ) x
where divides x y = mod x y == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment