Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created September 20, 2010 00:40
Show Gist options
  • Select an option

  • Save ldunn/587272 to your computer and use it in GitHub Desktop.

Select an option

Save ldunn/587272 to your computer and use it in GitHub Desktop.
let rec primesIn (ns: int list) (x: int) =
let newList =
(List.choose (fun y ->
match y with
| y when (y % x = 0) -> None
| _ -> Some y) ns)
if newList.[0]*newList.[0] <= newList.[newList.Length-1] then
x :: primesIn newList newList.[0]
else x :: newList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment