First time here? Check out the FAQ!

Ask Your Question
1

Polynomial division mod n

asked 11 years ago

cp_sage gravatar image

updated 11 years ago

Hi everyone,

Let's suppose that we are working with polynomials modulo n a composite number, for which we know the factorization (n=p*q). If we know that f(x) can be divided by e.g. g(x), what is the most efficient way to calculate f(x)/g(x) in Z_n with Sage?

Thanks for your time

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

vdelecroix gravatar image

I do not know if this is the best answer but it works

sage: K = Zmod(543)    # the ring Z/nZ
sage: R.<x> = PolynomialRing(K,'x')
sage: f = 3*x^5 + 2*x + 1
sage: g = 2*x + 1
sage: f.quo_rem(g)
(273*x^4 + 135*x^3 + 204*x^2 + 441*x + 52, 492)

The method quo_rem returns the 2-tuple made of the quotient and the remainder of the division.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 11 years ago

Seen: 2,230 times

Last updated: Jun 03 '13