網頁

Thursday 22 January 2015

Puzzle

A puzzle given by an office-mate:
There is a polynomial \(p(x) = a_0 + a_1x + a_2x^2 + \dots+a_nx^n\) where \(a_0, a_1, \dots, a_n \in \mathbb{Z}^+\). Knowing only \(n\), you may query the value of \(p(x)\) for any \(x\). The goal is to recover the coefficients with minimal queries.

Computational feasible solution (2 queries)
If we know the coefficients are bounded by \(m-1\) then \(p(m)\) is the \(m\)-based number \(\overline{a_na_{n-1}\dots a_0}\). Which, \(p(1)\) will give the upper bound of \(m\).

Theoretical solution (1 query)
Query \(p(\pi)\). As \(\pi\) is transcendental, the only integer solution to \(\sum a_i \pi^i = 0\) is all \(a_i = 0\). Therefore theoretically there is only one integer polynomial satisfying the query.

No comments:

Post a Comment