Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created September 19, 2010 07:29
Show Gist options
  • Select an option

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

Select an option

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