Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created September 18, 2010 01:29
Show Gist options
  • Select an option

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

Select an option

Save ldunn/585233 to your computer and use it in GitHub Desktop.
let rec dividesIntoAllUpTo (n: int) (d: int) =
match d with
| 1 -> true
| _ -> (n % d = 0) && (dividesIntoAllUpTo n (d - 1))
let matchesCriteria n =
dividesIntoAllUpTo n 20
let main =
let current_num = ref 20
while true do
if (not (matchesCriteria !current_num)) then
current_num := !current_num + 20
else
printfn "%i matches criteria!" !current_num
ignore (System.Console.ReadLine())
exit(0)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment