Factor a large number efficiently with gmp

前端 未结 4 1468
忘了有多久
忘了有多久 2020-12-17 02:06

I need to get all the prime factors of large numbers that can easily get to 1k bits. The numbers are practically random so it shouldn\'t be hard. How do I do it efficiently?

4条回答
  •  悲&欢浪女
    2020-12-17 02:47

    At the moment you cannot factor a bigint with GMP. You can convert your bigint to other libraries and use their factoring algorithms. Note that factoring of integers with >>20 digits needs specialized algorithms and is near exponentially slow.

    Check out:

    • http://flintlib.org/
    • http://pari.math.u-bordeaux.fr/
    • http://ecm.gforge.inria.fr/

提交回复
热议问题