Skip to content

Instantly share code, notes, and snippets.

Last active Dec 15, 2015
What would you like to do?
* :a:int64 -> b:bool
let isUglyNumber (x:int64) :bool =
let rec checkFactors (n_org:int64) (n:int64) lfactors =
match n with
| 1L -> true
| _ ->
match lfactors with
| [] -> false
| d::xs ->
if isFactor n d then
checkFactors n_org (n/d) lfactors
elif n > d then
checkFactors n_org n xs
checkFactors x x [2L;3L;5L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment