Does there exist a nonconstant, real analytic function $f \colon \mathbb{R} \to \mathbb{R}$ such that $f$ is periodic with period 1 and whose Maclaurin coefficients are all rational?


(The function $\sin x$ satisfies all the conditions except that its period isn't 1.)


I can't recall exactly what I was thinking about when this question occurred to me and my primary motivation now is curiosity. Note that if the answer is no, a proof that doesn't use the irrationality of $\pi$ would be an alternative way to prove irrationality of $\pi$ because of the function $\sin(2\pi x)$.


Also, WLOG, we may assume $f(0)=0$ and if we define the vector $c = (c\_k)$ where $f(x) = \sum\limits\_{k = 1}^{\infty} \frac{c\_k}{k!}x^k$ and let $v = (1, 1/2!, 1/3!, 1/4!, \dots)$, then by comparing the derivatives of $f$ at 0 and 1, we get that for all nonnegative integers $n$,
$$v \cdot C^n c = 0,$$
where $C$ shifts the components of a vector one space to the left.



Does there exist a nonconstant, periodic, real analytic function with period 1 and rational Maclaurin coefficients?
Yes, such $f$ exist, and can even be taken to be entire,
and with a preassigned finite initial segment $c\_0,c\_1,\ldots,c\_d$
of the sequence of $x^k/k!$ coefficients.


Indeed if $f(x) = \sum\_{k=0}^\infty a\_k \sin^k (2\pi x)$
then $f$ is entire provided $a\_k \rightarrow 0$ quickly enough,
say $a\_k \ll 1/k!$; and the map from $\{a\_k\}$ to $\{c\_k\}$
is linear and invertible, with $a\_k$ a linear combination of
$c\_0,\ldots,c\_k$ *and $c\_k$ a linear combination of* $a\_0,\ldots,a\_k$
for each $k$. So, solve for $a\_0,\ldots,a\_d$, and then inductively
choose small $a\_{d+1}, a\_{d+2}, a\_{d+3}, \ldots$ to make each of
$c\_{d+1}, c\_{d+2}, c\_{d+3}, \ldots$ rational. (One way to
avoid invoking the Axiom of Choice here is to fix some
enumeration of ${\bf Q}$ and then at each step with $k>d$
use the least-indexed $c\_k$ that makes $|a\_k| < 1/k!$.)


[I see now that **David Speyer** gave much the same solution
in a comment (using $g\_k$ for what I called $a\_k$),
though without bothering to make $f$ entire
or preassign the start of its Taylor expansion.]


