# Fractional Part of $a^n$

Prove that there exists a real number $a>1$, such that $\{a^n\}$ belongs to $[\frac{1}{3},\frac{2}{3}]$ for all positive integers $n$ and $\lfloor a^n\rfloor$ is even iff $n$ is a prime.

$a^n=\{a^n\}+\lfloor a^n\rfloor$, where $\{a^n\}$ is the fractional part of $a^n$ and $\lfloor a^n\rfloor$ is the largest integer not greater than $a^n$

• "$(\{a^n\} \in [\frac{1}{3},\frac{2}{3}] \wedge \lfloor a^n \rfloor \text{ is even} ) \leftrightarrow n\text{ is a prime}$" or "$\{a^n\} \in [\frac{1}{3},\frac{2}{3}] \wedge (\lfloor a^n \rfloor \text{ is even} \leftrightarrow n\text{ is a prime})$"? – JiK Aug 30 '14 at 20:51
• the second one: $\{a^n\} \in [\frac{1}{3},\frac{2}{3}] \wedge (\lfloor a^n \rfloor \text{ is even} \leftrightarrow n\text{ is a prime})$ – john Aug 30 '14 at 21:39
• Where is this from? – Mayank Pandey Aug 30 '14 at 21:40
• Is this problem easy if we remove the second condition? I can't figure out a solution to even the first condition. – dshin Oct 14 '14 at 19:08
• This would suggest a possible primality tester. Take a, raise it to the n'th power and check parity. Can be loose with precision because of first condition. – dshin Oct 14 '14 at 20:24

We can't find an exact value of $a$ but it is possible to construct it using the nested intervals theorem.
Let $I_1=[15+\frac13,15+\frac23]$. Assume $I_k=[a_k+1/3,a_k+2/3]$ is defined and also satisfy $I_k'=[(a_k+1/3)^{1/k},(a_k+2/3)^{1/k}]=[b_k,c_k]\subset I_1$. Then since $15<(a_k+1/3)^{1/k}=b_k<c_k$, $$(a_k+\frac23)^{1+\frac1k}-(a_k+\frac13)^{1+\frac1k}=c_k^{k+1}-b_k^{k+1}>(c_k^k-b_k^k)c_k>\frac13\cdot15=5$$ So the interval $J_k=[(a_k+\frac13)^{1+\frac1k},(a_k+\frac23)^{1+\frac1k}-1]$ contain at least $4$ integers which means there are both even number and odd number in $J_k$. Let $$a_{k+1}=\cases{\text{even number in }J_k&\text{,if }k+1\text{ is prime}\\\text{odd number in }J_k&\text{,otherwise}}$$ and define $I_{k+1}=[a_{k+1}+1/3,a_{k+1}+2/3]$.
From $$(a_{k+1}+\frac13)^{\frac1{k+1}}>a_{k+1}^{\frac1{k+1}}\ge((a_k+\frac13)^{1+\frac1k})^{\frac1{k+1}}=(a_k+\frac13)^{\frac1k}$$ and $$(a_{k+1}+\frac23)^{\frac1{k+1}}<(a_{k+1}+1)^{\frac1{k+1}}\le ((a_k+\frac23)^{1+\frac1k})^{\frac1{k+1}}=(a_k+\frac23)^{\frac1k}$$ we see that $I'_{k+1}\subset I'_k$. Thus by the nested intervals theorem, there is a real number $\displaystyle a\in\bigcap_{k=1}^\infty I'_k$. Now $a^k\in I_k=[a_k+1/3,a_k+2/3]$ where $a_k$ is even iff $k$ is prime. Thus $a$ satisfy the conditions in the problem.