5

I find some library with implementation of integer factorization function. Preferably some fast implementation in some popular library, to not reinvent the wheel.

Is there some ?

s9gf4ult
  • 862
  • 6
  • 20

2 Answers2

12

A quick google search shows arithmoi package by Daniel Fischer.

Satvik
  • 11,238
  • 1
  • 38
  • 46
2

See primeFactors in primes. It's reasonably fast, for example it factors 104729 * 104723 instantly.

Petr
  • 62,528
  • 13
  • 153
  • 317
  • Note that `104729 * 104723` can be deduced from a simple square root test and some linear probing. A better factorization litmus test would involve primes which are farther apart, but not too close to `1`. Consider `104729 * 88801` – recursion.ninja Jul 10 '14 at 18:25