Ask Your Question

Revision history [back]

Loop over integers mod p

What is the most efficient way to factor a polynomial mod $p$ for various $p$ all at once, perhaps to be assembled into a table with more fancy code?

For example, suppose I want to factor $x^2-17 mod p$ for the first 100 primes. My first guess is to type out the proper code to factor $x^2-17$ over the ring Integers(i) where i runs through an appropriate prime_range. But Sage says I am not allowed to put a variable into Integers(). So what is the best way to do this?