Let $$f(x) = \frac{1}{2}+\sum_{k=1}^\infty \frac{\mbox{sgn}(\sin kx)}{2^{k+1}} .$$ Here $\mbox{sgn}$ represents the sign function. Many simple integer and rational values of $x$ result in $f(x)$ very closely approximating some simple rational numbers, and you don't have to spend much time to identify plenty of them. Yet it seems obvious that if $x$ is rational, then $f(x)$ is irrational. One number that stands out is $$x = 10^5 + \frac{1}{10}\cdot\Big(\frac{3}{5}\Big)^2.$$

Surprisingly, $f(x)$ is almost equal to $\frac{2}{3}$, as the first $12,897$ binary digits of both numbers agree. Just after that, they disagree. You don't need a sophisticated algorithm to check this. Just compute $\mbox{sgn}(\sin kx)$ for $k=1, 2, \cdots, 12,897$. These signs alternate perfectly depending on whether $k$ is odd or even, just like the binary digits of $\frac{2}{3}$.


I started to have some doubts about the fact that if $x$ is rational, then the sequence $z_k = \mbox{sgn}(\sin kx)$ can not be periodic. Can someone prove that I am right, and that this weird number $x$ is just a coincidence, not leading to periodicity anyway. Do you have some explanation for these coincidences for so many different $f(x)$ values: very often, 20 or 30 binary digits match those of a simple rational, sometimes 40 and even 87 digits for the number $x=10^5$ itself -- but no pattern for $x=10^5-1, x=10^5-\frac{1}{10}, \mbox{ or } x = 10^5+1$. A pattern again for $x=2\cdot 10^5$ and for so many other numbers, starting with $x=1$ resulting in $f(x)=0.11111113\cdots$ (in base $10$).


Another number leading to almost periodicity is $x=\log_2 3$ resulting in $f(x) = 2/5$ (almost). But $x=\sqrt{2}/2$ does not yield the same spectacular result. It is a hit and miss.

Finally, try $x=\frac{355}{113}$. The first $11776655$ binary digits of $f(x)$ are identical to those of $\frac{2}{3}$. Not only $11776655$ is large, but even more surprising, look at the base-$10$ digits of $11776655$: two $1$, two $7$, two $6$, two $5$. Note that if you concatenate the base-$10$ digits of $355$ with those of $113$, you get $113355$.


1 Answer 1


The reason for the near-periodic behavior of the choice $x = 10^5 + \frac{9}{250}$ has to do with the fact that $$\frac{x}{\pi} \approx 31831.00007753496977,$$ which is almost an integer with error $\epsilon \approx 0.000077 < 10^{-4}$. Moreover, $$\frac{1}{\epsilon} \approx 12897.4062021729,$$ and now you can see why this many terms are needed.

The above also suggests that if you can find some choice of $x$ such that $$\frac{x}{\pi} - \left\lfloor \frac{x}{\pi} \right\rfloor$$ is extremely tiny, you can make this phenomenon extend to as large of a value of $k$ as you please. It just so happens that the particular choice $10^5 + \frac{9}{250}$ is also close to a round number in base 10.

  • 1
    $\begingroup$ Based on your answer, I updated my post, now with $x=\frac{355}{113}$ and the first $11776655$ binary digits of $f(x)$ equal to those of $\frac{2}{3}$. $\endgroup$ Sep 2, 2019 at 15:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .