Ask Your Question

Revision history [back]

Find quadratic polynomial such that f(x)=x^2+ax+b is prime

a. Find quadratic polynomial f(x)=x²+ax+b , a,b ∈ℤ such that f(x) is prime for 1≤n≤40

I know that the polynomial f(x)=x²-x+41 takes prime values for all 1≤n≤40. But how can I find this polynomial with sage?

b. Find k (as large as possible) and quadratic polynomial such that f(x)=x²+ax+b (a,b ∈ℤ) is prime for 1≤n≤k

Find quadratic polynomial such that f(x)=x^2+ax+b is prime

a. Find quadratic polynomial f(x)=x²+ax+b , a,b ∈ℤ such that f(x) is prime for 1≤n≤40

I know that the polynomial f(x)=x²-x+41 takes prime values for all 1≤n≤40. But how can I find this polynomial with sage?

b. Find k (as large as possible) and quadratic polynomial such that f(x)=x²+ax+b (a,b ∈ℤ) is prime for 1≤n≤k

I only find can b if I know a. But how can I find both?

P=Primes();
for b in range (0,1000000):
     success=true;
     for x in range (1,41): 
          if not (x^2-x+b) in P:
               success=false;
               break;
     if success:
         print b;