Let P(x) be a polynomial with non-negative integer coefficients such that P(0)=33, P(1)=40, and P(9)=60000. Find P(2).
Analytic
9^5 = 59049 so poly cannot have degree > 5
Sum of coefficients is 40
The last coefficient is 33
Let poly be ax^5 + bx^4 + cx^3 + dx^2 + ex + 33
a can only be 0 or 1, the other coefficients can be any from 0 to 9.
But sum(a,b,c,d,e) = 7
If a=0, the largest f(9) could be would be if b=7 and c=d=e=0. But this falls far short of 60000. The largest f(9) could be is 45960.
So a=1
Noting that 9^5 = 59049 and the final term is 33, the remaining terms (when x=9) must sum to:
60000 - 33 - 9^5 = 918
Since 9^4 = 6561, coefficient b must be zero.
So c+d+e = 6
Since 9^3 = 729, coefficient c must be zero or one, but if c=0, then the largest f(9) could be is 59568.
So c = 1
So d+e = 5
We have x^5 + x^3 + dx^2 + ex + 33
with d and e temporarily set to 0, f(9) = 59811
We need 189 more.
81d + 9e = 189
and d + e = 5
9d + 9e = 45
72d = 144
d=2 and e=3
Hence the polynomial:
P(x) = x^5 + x^3 + 2x^2 + 3x + 33
P(2) = 87
-----
Computer
def f(x,a,b,c,d,e):
return a*x**5 + b*x**4 + c*x**3 + d*x**2 + e*x + 33
for a in range(2):
for b in range(10):
if a+b > 7:
continue
for c in range(10):
if a+b+c > 7:
continue
for d in range(10):
if a+b+c+d > 7:
continue
for e in range(10):
if a+b+c+d+e != 7:
continue
if f(9,a,b,c,d,e) != 60000:
continue
print(f(0,a,b,c,d,e))
print(f(1,a,b,c,d,e))
print(f(2,a,b,c,d,e))
print(f(9,a,b,c,d,e))
print(a,b,c,d,e)
Output:
|
Posted by Larry
on 2024-08-16 12:20:02 |