7

I was playing with Excel and created a sequence with some interesting features.

In column A, list the sequence $\color{red}{a_n=\lceil \sin (2n) \rceil}$ (using the ceiling function).
In column B, list the sequence of gaps between the terms of the previous sequence.
In column C, list the sequence of gaps between the terms of the previous sequence.
And so on.

enter image description here

Let $b_n$ be the sequence in the top diagonal (highlighted).

Behold the graph of $|b_n/2^n|$ against $n$:

enter image description here

The terms on the approximate horizontal line are very close to $1/44$.

What's going on here?

More specifically:

  • Why does dividing the terms of $|b_n|$ by $2^n$ yield such stability (as opposed to making the terms go toward $0$ or infinity)?
  • Why are there long strings of values that are very close to $1/44$?
  • Why does the graph dip to $0$ at $n=698$ and then go back up?
  • How does the graph behave for $n>1000$?

I only have a fuzzy notion that the last three questions may be related to rational approximations for $\pi$.

For comparison purposes only: graphs derived from other starting sequences

If $a_n=\lceil \sin (\color{red}{1}n) \rceil$, here is the graph of $|b_n/2^n|$ against $n$:

enter image description here

If $a_n=\lceil \sin (\color{red}{3}n) \rceil$, here is the graph of $|b_n/2^n|$ against $n$:

enter image description here

If $a_n=\lceil \sin (\color{red}{4}n) \rceil$, here is the graph of $|b_n/2^n|$ against $n$:

enter image description here

If $a_n$ is a random binary sequence with $0$ and $1$ equally likely, here is one possible graph of $|b_n/2^n|$ against $n$:

enter image description here

If $a_n$ is the sequence of prime numbers, here is the graph of $|b_n/2^n|$ against $n$:

enter image description here

(Incidentally, the last two graphs resemble "Mountains of Guilin" functions, i.e. $f_{p_j,n}(x)=|\sin (p_1x)+\sin (p_2x)+\dots+\sin (p_nx)|$ where $p_j$ are linearly independent over $\mathbb{Q}$.)

(The answers to this question might resolve an earlier question of mine: Strange dips in sequence $u_n=\log{|(n-1)^{\text{st}}\text{ difference of first $n$ primes}|}$.)

Dan
  • 35,053
  • Try plotting its behavior between 1000 and 2000 . Somewhere along the line it reverses sign and −1/44 values tend to dominate for a while. – user3257842 Jul 19 '23 at 12:36
  • 1
    @user3257842 But the terms cannot be negative, because of the absolute value signs. (Anyway, my computer already feels like it's overheating, so I'm not sure I want to try to plot more terms.) – Dan Jul 19 '23 at 12:42
  • Oh, I didn't notice the absolute value. – user3257842 Jul 19 '23 at 12:45
  • Just a comment - $\sin2n$ is uniformly distributed on $[-1,1]$ so, on average, these values behave in a regular pattern. – Salcio Jul 19 '23 at 13:19
  • @Salcio Are you sure $\sin 2n$ is uniformly distributed on $[-1,1]$? The sine curve has an S-shape, making it denser near $-1$ and $1$, than near $0$. – Dan Jul 19 '23 at 13:39
  • Correction - ${2\pi n}$ is uniformly distributed. $\sin$ will "bend" it. Thx Dan. – Salcio Jul 19 '23 at 13:50
  • Not having the modulus gives more insight into the nature of the function: https://imgur.com/a/089lFm0 – user3257842 Jul 19 '23 at 14:13

1 Answers1

3

1. SOME CLAIMS

Fix a positive real number $\alpha$ and consider $$ a_k:=\begin{cases} 1,& \{\alpha k\}<1/2, \\ 0,& \{\alpha k\}\geq 1/2. \end{cases} $$ (Using $\lbrace x\rbrace= x-\lfloor x\rfloor\in [0,1)$, the fractional part of a real number $x$.)

Then, form the sequence $$ b_n=\sum_{k=1}^n \,(-1)^k \,\binom {n-1}{k-1}\, a_k, $$ and also $$ c_n=2^{1-n}|b_n|. $$

I will now make several claims. Hopefully they are true, and hopefully the gaps in the proofs can be filled in.


CLAIM 1. When $\alpha=1/\pi$, this gives rise to the sequence in the post, with the first values of $a_k$ being $$ 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, $$ and the first values of $b_n$ being $$ -1, -1, -1, 0, 3, 9, 18, 27, 27, 0, -81, -243, -486, -728, -715, 105, 2746, 8924, 21537, 45847. $$

This is easy. We have $\lceil\sin(2k)\rceil=$1 or $0$ precisely if $\{k/\pi\}<1/2$ or $>1/2$, respectively, hence $a_k=\lceil\sin(2k)\rceil$ for $\alpha=1/\pi$. Then use induction (or the formula for powers of the difference operator) to prove the formula for $b_n$.


Define, for $q>r\geq 0$ integers, $$ f_{n,r,q}=2^{1-n}\sum_{\substack{k=1,\ldots,n\\ k\equiv r\mod q}}^n(-1)^k \binom{n-1}{k-1}. $$

CLAIM 2. Let $\omega=\exp(2\pi i/q)$. Then $$ f_{n,r,q}=-\frac 1q\sum_{\ell=0}^{q-1}\frac{(1-\omega^\ell)^{n-1}}{2^{n-1}}\omega^{-\ell (r-1)}. $$ As a consequence, as $n\to+\infty$, $$ f_{n,r,q}\to\begin{cases}\frac {(-1)^r}{q},&\mbox{if }q\mbox{ is even},\\ 0,&\mbox{otherwise}.\end{cases} $$

(See these nice notes, Section 6.)


CLAIM 3. We have $\lim_{n\to+\infty}c_n=0$ unless $\alpha=p/q$ is rational with $p,q$ coprime integers and $q$ equal to twice an odd number, in which case $\lim_{n\to+\infty}c_n=1/q$.

Ideas for a proof: If $\alpha=p/q$ is rational ($p,q$ coprime integers) then $$ 2^{1-n}b_n=\sum_{\substack{r=0,\dots,q-1 \\ \lbrace rp/q\rbrace<1/2}}f_{n,r,q} $$ and so, by the previous point, we get $$ \lim_{n\to+\infty}c_n=\biggl|\lim_{n\to+\infty}2^{1-n}b_n\biggr| = \frac 1q\biggl|\sum_{\substack{r=0,\dots,q-1 \\ \lbrace rp/q\rbrace<1/2}}(-1)^r\biggr|. $$ It should not be too hard to prove that $$ \sum_{\substack{r=0,\dots,q-1 \\ \lbrace rp/q\rbrace<1/2}}(-1)^r =\begin{cases} \pm1,& \mbox{if }q=2\times\mbox{ odd integer},\\ 0,&\mbox{otherwise}. \end{cases} $$

If instead $\alpha\not\in\mathbb Q$, we can pick (Dirichlet approximation) a fraction $p/q$ ($p,q$ coprime) such that $|\alpha-p/q|<1/q^2$ with $q$ arbitrarily large. Then $a_k(\alpha)=a_k(p/q)$ for all $k\leq q$ (or, at least, for most of the values, in a way to be made precise!), such that $c_n(\alpha)$ is essentially $c_n(p/q)$ for all $n\leq q$ and one should bound $c_n(p/q)$ in a smart way, using the explicit expression for $f_{n,r,q}$. I may try to sort out the details in the future.


2. NUMEROLOGY IN THE PLOT AND THE CONTINUED FRACTION EXPANSION OF $\pi$.

The above facts being established (rather, claimed), let us look at the following plots of $c_n$ for $\alpha=1/\pi$ (i.e., the original quantity of interest in the question, up to a factor of $2$): first for $n=1,\ldots,10000$

enter image description here

and then for $n=100,\ldots,50000$ (plotting for values multiple of $50$ only)

enter image description here

(The last plot confirms that eventually, in the long run, $c_n\to 0$ for $\alpha=1/\pi$).

It is natural to guess that the following two facts observed in the question might have an interesting explanation in terms of the first few convergents of $\pi$ $$ 3,\frac{\color{red}{22}}{7},\frac{333}{106},\frac{\color{red}{355}}{113},\frac{103993}{33102},\ldots $$ ($355/113$ being amazingly good).

  1. The values of $c_n$ at the plateaux are very close to $1/\color{red}{22}$ for the first several plateaux.

  2. The separation between plateaux occurs at values which are very close to even multiples of $\color{red}{355}$.

In fact, an explanation for 1. is that the values of $a_k$ for $\alpha=1/\pi$ and $\alpha=7/22$ coincide for all $k<355$. Since $22$ is twice an odd integer, the graph for $\alpha=7/22$ stabilizes to $1/22$. Since the graph for $\alpha=1/\pi$ must coincide with that for some time, this essentially explains the plateaux and its value $1/22$.

Similarly, the $a_k$'s for $\alpha=1/\pi$ and $113/355$ coincide for all $k<52174$. So, even the larger plot reported above coincides with the one for $113/355$, whence it should not be surprising the all the properties of the plot so far are determined by these first convergents.

As a similar example we may consider the convergents of $3/55$, which are $\frac 1{18}, \frac 3{55}$. Here are the plots of $c_n$ for these two values: they coincide for a while, then one stabilizes to $\frac 1{18}$ and the other one eventually goes to zero exhibiting a periodicity $2\times 55$. Again, the initial plateaux of the plot for $3/55$ are explained by the first convergent $1/18$.

enter image description here


3. FINAL COMMENTS

In conclusion, comments about the 4 questions in the original post.

  • Dividing by $2^n$ (rather, by $2^{n-1}$, as it seemed more natural to me) "stabilizes" the sequence $b_n$ probably because $b_n$ is a sum of terms $-a_1,\dots,(-1)^na_n$ (more or less half of which are $\pm 1$s and half $0$s) against binomial coefficients $\binom{n-1}{k-1}$. Therefore, $$ \sum_{k=1}^n\binom{n-1}{k-1}=2^{n-1} $$ is the appropriate normalization for such a quantity (which can now be interpreted as an average of terms equal to $\pm 1$ and $0$).

  • In view of this, plateaux and dips in the plot probably correspond to a different balances of $+1$ and $-1$ in these sums weighted by binomials (constructive or destructive interference of terms of different signs).

  • The plot eventually goes to zero.

Giulio R
  • 3,267
  • Very interesting! So it seems that, among all the numerators of covergents to $pi$, only $22$ and $355$ determine the general shape of the graph. I find that strange. – Dan Jul 20 '23 at 11:21
  • By the way, may I ask what software did you use to generate your sequences and draw your graphs? – Dan Jul 20 '23 at 11:22
  • 1
    I used Mathematica (unfortunately it is not free). Here is the code I used

    a[alpha_, k_] := api[k] = If[FractionalPart[alpha k] < 1/2, 1, 0]; b[alpha_, n_] := bpi[k] = Sum[(-1)^k Binomial[n - 1, k - 1] a[alpha, k], {k, 1, n}] c[alpha_, n_] := N[Abs[b[alpha, n] 2^(1 - n)]]; DiscretePlot[c[1/Pi, n], {n, 1, 10000}] DiscretePlot[c[1/Pi, n], {n, 100, 50000, 50}]

    – Giulio R Jul 20 '23 at 12:27
  • I do not think it is strange that 355 determines the shape of the graph. The $a_k$'s for $1/\pi$ or for $113/355$ coincide for all $k<52174$. Therefore also the $b_n$'s agree for $n<52174$. Therefore, even the largest plot I made coincides with the plot relative to $113/355$. I must confess instead that the reason why 22 plays a special role is not clear to me. – Giulio R Jul 20 '23 at 12:30
  • That makes sense, but what about for $n>52174$? Is the general shape of the graph still only determined by $22$ and $355$? – Dan Jul 20 '23 at 12:38
  • 1
    I suspect no (in fact the value at the plateaux decreases from 1/22 so that you cannot really say that 22 plays any special role far away in the graph). I guess going much further you would also see a more "random" plot approaching zero with this period $2\times 355$ also disappearing. Actually I realized also why 1/22 plays a role, I will update the answer. – Giulio R Jul 20 '23 at 12:43
  • 1
    I've done some Fourier transforms on the formulas, and obtained the following sums:

    $$b_{n}/2^{n} = \sum_{w\in \mathbb{Z}} \frac{ie^{2i(1-2w)} ; (\frac{e^{2i(1-2w)}-1}{2})^n }{-{2\pi (1-2w)} }$$

    $$b_{n}/2^{n} = \sum_{w\in \mathbb{Z}} \frac{(-\sin(1 - 2 w))^n; \sin((1 - 2 w - \pi/2)(n + 2)) }{-{2\pi (1-2w)}} $$

    Maybe they can help.

    – user3257842 Jul 20 '23 at 12:45