Integer gcd is not that slow. Factorising large integers into primes is though.

If you represent integers in terms of their prime factorisation then
how can you efficiently add two integers?

On Sat, 6 Aug 2022 at 15:08, Thomas Ligon <thomassli...@gmail.com> wrote:
>
> Is there any way to do this, perhaps just by saying that I want to keep prime 
> factors instead of decimal digits?
> Background: I am writing software (using Python and SymPy) to calculate the 
> coefficients of a power series. By using Rational(0) to initialize sums and 
> Rational(1,2) to avoid getting a floating point, I have results that are 
> always rational, specifically quotients of large integers and have reached 
> the point where the integers have about 50 digits. I have a (fairly complex) 
> recursive function that calculates the coefficient of x**(n+1) when the 
> coefficients of x**n are known. When calculating the sum of two rational 
> numbers, this most likely calculates the greatest common denominator, 
> something which is sure to be hard. If all of the integers were always stored 
> in terms of their prime factors instead of decimal digits, it would be much 
> more efficient.
> Is there such a feature out there somewhere?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/7171be2f-67a7-4d48-8eac-5d37571677c4n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxTbrJwOfx8X%3DFHdZ8e-J3w0_qAt6iWBxW2POzJ9%3DNb9zw%40mail.gmail.com.

Reply via email to