Problem One. Write a Sage function which takes as an input a polynomial p. The polynomial p will be a symbolic expression with integer coefficients. The function will return the count of how often the sign of the coefficients has changed. For instance the polynomial p(x) = x3 − x2 + x + 15 changes sign twice since the coefficients are 1, −2, 1, 15.
Input example :
problem1(11*x^6 - 6*x^5 + 5*x^4 - 58*x^3 - 51*x^2 + 9*x + 22)
Output example: 4
As part of your solution to this problem, provide the Sage function and the output for
p = -2*x^7 + 3*x^6 - 28*x^5 + 44*x^4 - 11*x^3 - 71*x^2 + 6*x - 14
Problem Two. Write a Sage function which takes as an input an integer M. Output the number of prime numbers ≤ M that are of the form k2 + k + 1. If M = 30 then the output would be 3 since there are three prime numbers ≤ 30 that are of the form k2 +k+1: 3 = XXXXXXXXXX,7 = XXXXXXXXXXand 13=32 +3+1.
problem2(300)
Output example: 9
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here