Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* the AC/DC said n is in [100;1000[ *)
- let mystery_func n =
- if ((n > 99) && n < (1000)) then
- let hundreds = (n / 100) and tens = ((n/10) mod 10) and units =(n mod 10) in
- if (hundreds + tens + units) < 10 then
- let prod_2_first = (hundreds * tens) in
- (prod_2_first < units) && (tens = (units - hundreds))
- else
- false
- else
- invalid_arg ((string_of_int(n))^" is not a three digits positive int");;
- let forAll n =
- string_of_int(n)^": "^string_of_bool(mystery_func(n))^(
- if (n < 999) then
- forAll(n+1)
- else
- ""
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement