# Is the sequence: $S_n=\Im(n\cdot\exp(\frac{2\pi\cdot i}{\log_{n}(p_n\#)})):n\in\Bbb N$ monotonic for $P_n>41893$?

How many times does the sequence: $S_n=\Im\left(n\cdot\exp\left(\frac{2\pi\cdot i}{\log_{n}(p_n\#)}\right)\right):n\in\Bbb N$ oscillate? I.e. is it monotonic increasing after $S_{4379}$ which corresponds to the prime $p_{4379}=41893$?

Where $p_n$ is the $n^{th}$ prime and $\Im$ is the imaginary part?

It follows from this that $\lim_{n\to\infty} \Im\left(n\cdot\exp\left(\frac{2\pi\cdot i}{\log_{n}(p_n\#)}\right)\right)=2\pi$

The function has a local maximum of $S_{15}\approxeq6.05344172$ representing the prime $47$.

Then I visibly found the minimum of $S_{4379}\approxeq5.540336$ representing the prime $41893$

Then it rises for quite a while. I was curious whether this was a one-off dip before it just rises, or whether it has multiple, or infinitely many maxima and minima.

If we first consider this graph, the sequence of ever-wider spirals in purple represents the primorial numbers and against those $S_n$ is plotted in green.

I cobbled together some python code to assess what primes are local maxima and minima. This finds the primes less than $n$ (adapted from a post on Stack Overflow):

import numpy
def primesfrom2to(n):
""" Input n>=6, Returns a array of primes, 2 <= p < n """
sieve = numpy.ones(n//3 + (n%6==2), dtype=numpy.bool)
for i in range(1,int(n**0.5)//3+1):
if sieve[i]:
k=3*i+1|1
sieve[       k*k//3     ::2*k] = False
sieve[k*(k-2*(i&1)+4)//3::2*k] = False
return numpy.r_[2,3,((3*numpy.nonzero(sieve)[1:]+1)|1)]


This pairs them with their primorials:

def primorials2to(n):
#        primesfrom2ton=primesfrom2to(n)
primorialpairs = [[1,1]]
for prime in primesfrom2to(n):
#            print(prime)
#            print(primorial[-1])
prime = int(prime)
primorialpairs.append([prime,primorialpairs[-1]*prime])
del primorialpairs
return primorialpairs


This returns the sequence $S_n$ paired with the index $n$:

def nheight(n):
nheight=[]
for i,pair in enumerate(primorials2to(n),1):
#            print(pair * math.sin(2 * math.pi * math.log(pair)/math.log(pair)))
#            print (i+1)
nheight.append([i,i * math.sin(2 * math.pi * math.log(i)/math.log(pair))])

return nheight


Then this function lists values of $[n,S_n]$ where the function changes direction:

def printturns (n):
last = [0,1]
goingup = True
for pair in nheight(n):
#        print (pair)
#        print (pair<last)
#        print (goingup)
#        print ((pair<last) == goingup)
if (pair<last) == goingup:
print(last)
goingup = not goingup
last = pair
return


Anyway, searching by this method revealed there is a sudden run of 13 changes in direction in very close proximity around $S_{4379}$ as follows, listed [$n,S_n$]:

[15, 6.053441727141416]
[3978, 5.540387890633058]
[3994, 5.540388863782968]
[4193, 5.540357214031067]
[4196, 5.540357262609376]
[4222, 5.540355991027424]
[4223, 5.540356005545033]
[4321, 5.540339284373851]
[4322, 5.540339284425826]
[4356, 5.540336472266259]
[4362, 5.540336663467852]
[4368, 5.54033656089612]
[4369, 5.540336566062151]
[4379, 5.540336231417499]


The primes $p_n$ of these $n$ don't show up in OEIS or elsewhere as having any known significance. I've searched primes up to the magnitude of $1,600,000$ and found no more as the valuation still rises towards $2\pi$. But my computer is creaking.

In the absence of an algebraic proof, I may adjust the code to search higher. It's memory intensive as it maintains a list of every prime and primorial below the maximum searched, which isn't nearly necessary.

• This shouldn't be at all hard to prove using known bounds on the Chebyshev function $\theta(x)$; see en.wikipedia.org/wiki/Chebyshev_function#Asymptotics_and_bounds, especially the third bound there (which is a bit larger than your current code reaches). Note that you really should be working with $\log(p_k\#)$ directly, not with $p_k\#$ itself, in your code; it's a much more manageable value. You may need greater precision than float/double offer, but that's straightforward. – Steven Stadnicki Sep 12 '18 at 21:42
• @StevenStadnicki actually I mean if $u(\vartheta(x))$ is the upper bound and $l(\vartheta(x))$ the lower bound then to show monotonicity do I need to show that there is some $x_p$ such that for all $x>x_p:$ $l(\vartheta(x+1))\geq u(\vartheta(x))$? – user334732 Sep 13 '18 at 18:51