Context:
I recently saw user @David's profile picture and description:
"My icon is the graph of the exponential sum $$\sum_{n=1}^{10620}e^{2\pi if(n)}$$ for $$f(n)=\frac{n}{20}+\frac{n^2}{9}+\frac{n^3}{59}\ ,$$ where the "graph" of an exponential sum means the sequence of partial sums, plotted in the complex plane, with successive points joined by straight line segments."
This intrigued me, so I decided to investigate. My findings and questions are below.
Reproducing it in Desmos: (for those interested)
I first decided to recreate the picture on Desmos. You can see it here (it will take a while to load).
I created the image by defining $f(x)$ as it is defined above, then setting $$ x_2(x)=\sum_{k=1}^{x}\cos(2\pi f(k))\\ y_2(x)=\sum_{k=1}^{x}\sin(2\pi f(k))\\ p(x)=(x_2(x),y_2(x)) $$ So that $p(x)$ was essentially $\sum_{k=1}^{x}e^{2\pi i f(k)}$. Then I defined the lists $$\begin{align} I_1&=[1,2,\dots,1000]\\ I_2&=[1001,1002,\dots,2000]\\ \dots &\dots\\ I_{10}&=[9001,9002,\dots,10000] \end{align}$$ Then entering $p(I_{1}),\ p(I_2),\ \text{etc.}$ gave a whole bunch ($10000$ to be precise) of points. Then clicking the little gear symbol and then the colored circle next to each entry (on the left) I was able to connect the points $p(i)$ and $p(i+1)$ for any integer $1\leq i\leq 9999$. I used the $10$ different lists instead of $1$ in order to keep Desmos from freaking out.
My investigations:
Also using Desmos and the same technique as described above, I decided to create the graphs corresponding to the functions $$H_n(x)=x+\frac{x^2}2+\frac{x^3}3+\dots+\frac{x^n}n\qquad (n>1)$$ i.e. I made the graphs for $$p(k)=\left(\sum_{r=1}^{k}\cos[2\pi H_n(r)],\sum_{r=1}^{k}\sin[2\pi H_n(r)]\right)$$ I made each sequence/graph have $700$ points (AKA I graphed $p([1,2,...,700])$) just to see if any irregular behavior started to occur. Here are the graphs for the first $6$ values of $n$.
$n=5$:
I do not know how well you can see it, but the points are starting to move around a little. This is a picture of the $n=5$ graph when I zoomed in on one of the corners:
$n=6$:
Needless to say, the wiggly effect has been amplified. For comparison, here's the $n=6$ graph of $p([1,2,...,31])$:
$n=7$:
Which is very far from well behaved. I think its 'supposed' to look something like the graph of $p([1,2,...,105])$:
Although even that has some drifty looking points.
You can look at more of these graphs by changing the value of $n$ on this graph.
Questions:
At this point I'm fairly certain that the strange behavior (as demonstrated by the cases $n=5,6,7$) can be attributed to the accumulating numerical inaccuracies of Desmos. For example, Wolfram evaluates $$A=\sum_{r=1}^{700}\exp[2i\pi H_{7}(r)]$$ as $$A= -11.470821630307989891763598910658573978486117477630759175...\\ - 3.6768673678262517039383839969453158461799151084757854088... i$$ and provides a monstrous closed form. Whereas Desmos puts the sum at the wildly incorrect $$1.3535617164+9.88880050357i$$ I did the same sort of test with $B=\sum_{r=1}^{20}\exp[2i\pi H_5(r)]$ and Wolfram gave $$B=-6.3944653536668510841041628532095052345320229467766883302... \\+ 1.0127838162151622424794134150036094634983505690619992502... i$$ And Desmos gave $$-6.39446535424+1.01278381623i$$ Which is conclusive evidence that Desmos gets less accurate as $n$ and $x$ grow.
That was the subject of my original question, but it seems to have been resolved by now.
So my question is how do we find a general formula for $\pi_n\in\Bbb N$ such that $$\forall k\in\Bbb N,\quad f_n(k+\pi_n)=f_n(k)$$ where $$f_n(k)=\sum_{\ell=1}^{k}\exp[2i\pi H_n(\ell)]$$ I found the first few values: $$\pi_2=2\\ \pi_3=6\\ \pi_4=6\\ \pi_5=30\\ \pi_6=30$$ But there's got to be some other way to do this. Any help is appreciated.