Assume $f\colon \mathbb Q\to \mathbb Q$ is a function which admits continuous extensions


* $f\_0\colon\mathbb R\to \mathbb R$ and
* $f\_p\colon \mathbb Q\_p\to \mathbb Q\_p$ for each prime $p$.



> 
> Is it true that $f$ is a polynomial?
> 
> 
> 


I guess the answer is **no**, but I do not see a counterexample. 



Continuous extensions reals and to p-adic numbers
The answer is no, and one can essentially use the same construction as in the answer:
[Is a real power series that maps rationals to rationals defined by a rational function?](https://mathoverflow.net/questions/42460)


Specifically, enumerate the non-zero rationals $\{r\_1,r\_2, \ldots\}$ in some way. Now consider the function:
$$f(x) = \sum\_{n=1}^{\infty} c\_n x^{n^2} \prod\_{i=1}^{n} (x - r\_i).$$
If $c\_n \in \mathbf{Q}$, then this is a well defined function from rationals to rationals.
On the other hand, $f(x)$ converges to an analytic function in $\mathbf{Q}\_v$ if and only if the coefficients of this power series converge to zero fast enough.
Since the coefficients of the power series in the range $k = n^2$ to $k < (n+1)^2$
are simply the cofficients of $c\_n x^{n^2} \prod\_{i=1}^{n} (x - r\_i)$, this can be ensured
by forcing these coefficients to be very highly divisible by the first $n$ primes, and small in the archimedean sense (by including a very very large prime in the denominator). 


