Skip to content

Commit

Permalink
Closes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaprieto committed Jan 9, 2023
1 parent ec28dc8 commit 6803647
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Stdlib/Data/Nat/Gcd.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Stdlib.Data.Nat.Gcd;

open import Stdlib.Prelude;
open import Stdlib.Data.Nat.Ord;

terminating
gcd : Nat → Nat → Nat;
gcd a b :=
if (a == b)
a
(if (a > b)
(gcd (sub a b) b)
(gcd a (sub b a)));
end;

0 comments on commit 6803647

Please sign in to comment.