Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect gcd #107

Closed
sumiya11 opened this issue Jan 31, 2022 · 1 comment
Closed

incorrect gcd #107

sumiya11 opened this issue Jan 31, 2022 · 1 comment

Comments

@sumiya11
Copy link
Contributor

Hi, the following seems to be incorrect

using DynamicPolynomials
@polyvar x

f = (7x - 1)*(4x + 3)^2*(x^2 + 5x + 13)^5
g = (4x + 3)*(x^3 - x - 1)^3*(x - 2)^2

gcd(f, g)
1
@blegat
Copy link
Member

blegat commented Mar 18, 2022

It seems the Int has overflowed. Closing as a duplicate of #110

julia> f = (big(7)*x - 1)*(4x + 3)^2*(x^2 + 5x + 13)^5
112x¹³ + 2952x¹² + 39119x¹¹ + 334446x¹⁰ + 2030940x⁹ + 9139695x⁸ + 31019925x⁷ + 79293780x⁶ + 149850240x⁵ + 200266105x⁴ + 173228211+ 78055016+ 8054202x - 3341637

julia> g = (big(4)*x + 3)*(x^3 - x - 1)^3*(x - 2)^2
4x¹² - 13x¹¹ - 8x¹⁰ + 39x⁹ + 39x⁸ - 63x⁷ - 94x⁶ + 22x⁵ + 107x⁴ + 47- 35- 40x - 12

julia> gcd(f, g)
4x + 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants