Irrationality based on series expansion condition The exercise
"Let suppose that $f$ is a function that admits a Taylor expansion such that 
$$
\forall x\in \mathbb{R}, \ f\left(x\right)=\sum_{n=0}^{+\infty}a_nx^n
$$
with $a_n \in \left\{0,1\right\}$ and that
$$f\left(\frac{2}{3}\right)=\frac{3}{2}$$
Prove that $\displaystyle f\left(\frac{1}{2}\right)$ is irrational."
My attempt ( which has two main problems )
I've tried proving that with such a function, $\displaystyle \left(a_n\right)_{n \in \mathbb{N}}$ cannot have a finite number of $1$. I think this statement is true, but I dont know how to prove it, that's the first problem.
I've supposed that the sequence $\displaystyle \left(a_n\right)_{n \in \mathbb{N}}$ was periodic of period $T \in \mathbb{N}^{*}$, it led me to the expression 
$$
f\left(x\right)=\frac{\displaystyle \sum_{n=0}^{T-1}a_nx^n}{1-x^{T}}
$$
I dont how I can find a contradiction with this using this expression and the fact that $\displaystyle f\left(\frac{2}{3}\right)=\frac{3}{2}$. That's the second problem.
However, with this two "hics" solved, we would have that $\displaystyle \left(a_n\right)_{n \in \mathbb{N}}$ is infinite and cannot be periodic, hence the binary expansion of the real $\displaystyle f\left(\frac{1}{2}\right)$ would be infinite and not repreating would be irrational.
Any Idea ?
 A: Suppose that
$$
\frac32=\sum_{n=0}^Na_n\Bigl(\frac23\Bigr)^n.
$$
Then
$$
3^{N+1}=2\sum_{n=0}^Na_n\,2^n\,3^{N-n}.
$$
The left hand side is odd, while the right hand side is even. This solves the first problem. The second can be dealt similarly. With your notation, if
$$
\frac32=\frac{\sum_{n=0}^{T-1}a_n\bigl(\frac23\bigr)^n}{1-\bigl(\frac23\bigr)^T},
$$
then
$$
3^T-2^T=2\sum_{n=0}^{T-1}a_n\,2^n\,3^{T-1-n}.
$$
A: Let's see what happens when $(a_n)$ is a repeating sequence, shall we? Say $(a_n)$ starts repeating at $n=N$. Then we know the non-repeating part is
$$\sum_{i=0}^{N-1}a_i(\tfrac23)^i$$
Then say it repeats with period length $P>0$; define $(b_n)_{n=0}^{P-1}$ as the row of numbers that $a_i$ repeats with; that is, $a_{N+Pj+i}=b_i$ for all non-negative integers $j$ and for $0\leq i<P$. Then we know
$$f(\tfrac23)=\sum_{i=0}^{N-1}a_i(\tfrac23)^i+\sum_{a=0}^{P-1}\sum_{i=0}^\infty b_a(\tfrac23)^{N+Pi+a}$$
We know that 
$$\sum_{i=0}^\infty b_a(\tfrac23)^{N+Pi+a}=b_a(\tfrac23)^{N+a}\sum_{i=0}^\infty (\tfrac23)^{Pi}=b_a(\tfrac23)^{N+a}\frac{1}{1-(\tfrac23)^P}=b_a\frac{2^{N+a}3^P}{3^{N+a}(3^P-2^P)}$$
So that
$$f(\tfrac23)=\sum_{i=0}^{N-1}a_i(\tfrac23)^i+\sum_{a=0}^{P-1}b_a\frac{2^{N+a}3^P}{3^{N+a}(3^P-2^P)}$$
Note that these sums are finite; a lot easier to work with!

Now we know:

$$\frac32=\sum_{i=0}^{N-1}a_i(\tfrac23)^i+\sum_{a=0}^{P-1}b_a\frac{2^{N+a}3^P}{3^{N+a}(3^P-2^P)}$$
which we can rewrite
$$3^{N+1}=2\sum_{i=0}^{N-1}a_i2^i3^{N-i}+2\sum_{a=0}^{P-1}b_a\frac{2^{N+a}3^{P-a}}{3^P-2^P}$$
Or
$$(3^P-2^P)\left(3^{N+1}-2\sum_{i=0}^{N-1}a_i2^i3^{N-i}\right)=2\sum_{a=0}^{P-1}b_a2^{N+a}3^{P-a}$$
Yay! We only have integers left. Let's now look $\mod 2$: the left-hand side is
$$(3^P-2^P)\left(3^{N+1}-2\sum_{i=0}^{N-1}a_i2^i3^{N-i}\right)\equiv (1-0)(1-0)\equiv 1\mod 2$$
However, the left-hand side clearly has a factor $2$, so can not be $1\mod2$; contradiction, hence $(a_n)$ can not be a repeating sequence.
