Open shwaka opened 1 year ago
"binary GCD" を使うと速く計算できるらしい。 先にgcd用のテストを書いた方が良い気がする。
Reference:
ionspin/kotlin-multiplatform-bignum では binary GCD を使って実装してるっぽい。
ionspin/kotlin-multiplatform-bignum
https://github.com/ionspin/kotlin-multiplatform-bignum/blob/281d0e79ddc48883134bdbf91224c967bcbe6aee/bignum/src/commonMain/kotlin/com/ionspin/kotlin/bignum/integer/base63/array/BigInteger63Arithmetic.kt#L1731-L1743
java.math.BigInteger.gcd も binary GCD で実装されてるっぽい?
java.math.BigInteger.gcd
とりあえず JavaRational で java.math.BigInteger.gcd を使ってみた cba1b695032b1684116c448d5ee74f7c044d3a72
JavaRational
"binary GCD" を使うと速く計算できるらしい。 先にgcd用のテストを書いた方が良い気がする。
Reference: