September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,8 @@
|
|||
(defn stein-gcd [a b]
|
||||
(cond
|
||||
(zero? a) b
|
||||
(zero? b) a
|
||||
(and (even? a) (even? b)) (* 2 (stein-gcd (unsigned-bit-shift-right a 1) (unsigned-bit-shift-right b 1)))
|
||||
(and (even? a) (odd? b)) (recur (unsigned-bit-shift-right a 1) b)
|
||||
(and (odd? a) (even? b)) (recur a (unsigned-bit-shift-right b 1))
|
||||
(and (odd? a) (odd? b)) (recur (unsigned-bit-shift-right (Math/abs (- a b)) 1) (min a b))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue