Greatest common divisor: Difference between revisions

Content added Content deleted
(Undo revision 202937 by Grondilu (talk) not really better on second thought)
(→‎{{header|OCaml}}: idiomatic version)
Line 2,064: Line 2,064:
else if a > b then gcd b (a mod b)
else if a > b then gcd b (a mod b)
else gcd a (b mod a)</lang>
else gcd a (b mod a)</lang>

A little more idiomatic version:
<lang ocaml>let rec gcd1 a b =
match (a mod b) with
0 -> b
| r -> gcd1 b r</lang>


=== Built-in ===
=== Built-in ===