Puzzle time - Recovering the Polynomial
-
wrote on 22 May 2022, 14:40 last edited by
The Oracle at Delphi has in mind a certain polynomial p (in the variable x, say) with non-negative integer coefficients. You may query the Oracle with any integer n, and the Oracle will tell you the value of p(n).
How many queries do you have to make to determine p?
-
wrote on 22 May 2022, 17:27 last edited by Horace
Well n+1 points define a polynomial of order n, in the same way that two points define a line, but the restriction to non-negative integer coefficients must make a better answer possible. The way the question is worded implies that a constant answer suffices for polynomials of any order. Can a polynomial expression with non-negative integer coefficients be simplified into a form of a(x^n)+b?
But the answer is probably not to simplify it a priori, but rather to gather information from the first guess to narrow down which would be the most informative next guess.
-
wrote on 22 May 2022, 18:38 last edited by
I'd start with p(1).
If p(1) = m , then all coefficients must be <= m.
That reduces the number of candidates quite a bit.
-
wrote on 22 May 2022, 18:41 last edited by Klaus
Ah, I think I got it!
click to show -
wrote on 22 May 2022, 19:00 last edited by
@Klaus said in Puzzle time - Recovering the Polynomial:
Ah, I think I got it!
click to showclick to show -
wrote on 23 May 2022, 02:31 last edited by jon-nyc
Very nice Klaus and a very surprising result given it works for any n.
-
wrote on 23 May 2022, 07:30 last edited by
I think if I could query the oracle with any number, not just integers, I could do it with just one query.
Just take an arbitrary transcendental number (such as Pi). No two integer-coefficient-polynomials will agree on that number. Enumerate all non-negative-coefficient-polynomials until you get to the one that agrees with the result. (the method is not entirely practical, though, because it depends on comparing numbers that cannot be finitely represented with digits).