A prime counting function I have never seen

The formula [imath] \pi(e^x)=\dfrac{e}{\sqrt[2]{e}}\cdot \dfrac{e}{\sqrt[3]{e}}\cdots\dfrac{e}{\sqrt[x]{e}}[/imath] means [imath] \dfrac{\pi(e^x)}{e^x}=e\cdot \dfrac{1}{\sqrt[2]{e}}\cdot \dfrac{1}{\sqrt[3]{e}}\cdots\dfrac{1}{\sqrt[x]{e}}.[/imath] If we assume that [imath] \pi(x)\sim\dfrac{x}{\log x} [/imath] then [imath] \dfrac{\pi(e^x)}{e^x}\sim \dfrac{1}{\log e^x}=\dfrac{1}{x} [/imath] and we have to compare the product of roots with the value [imath] 1/x. [/imath] Now the series expansion at infinity for the product of roots is

[math]\begin{array}{lll} \displaystyle{e\cdot \prod_{k=2}^n \dfrac{1}{\sqrt[k]{e}}=\dfrac{e^{2-\gamma}}{n} - \dfrac{e^{2-\gamma}}{2n^2} + \dfrac{5e^{2-\gamma}}{24n^3} -\dfrac{e^{2-\gamma}}{16n^4} + \dfrac{47e^{2-\gamma}}{5760n^5}+ O\left(\dfrac{1}{n^6}\right)\approx \dfrac{e^{1.423}}{n}+ O\left(n^{-2}\right)\approx\dfrac{ 4.148655621}{n}+O\left(n^{-2}\right)} \end{array}[/math]
This means that you have a systematic error of a bit over [imath] \dfrac{3}{x} [/imath] in your formula. This becomes smaller with larger values of [imath] x. [/imath] Nevertheless it is an error. [imath] \gamma \approx 0.57721\ldots[/imath] is the Euler-Mascheroni constant, defined as [math] \displaystyle{\gamma= \lim_{n \to \infty} \left(-\log n +\sum_{k=1}^n\dfrac{1}{k}\right)}.[/math]
You should divide your formula for [imath] \pi(x) [/imath] by [imath] e^{2-\gamma} [/imath] to get an error of the magnitude [imath] 1/x^2. [/imath]
I have been playing around with this for awhile. Then I went back to looking at e like this..
1+(1/n)^n. It seems like if you multiply n by 2 you get a very good approximation for what we were playing around with earlier.
IMG_3280.jpeg
Any thoughts?
Edit. It should be the n-2 that gets divided by 2. Sorry
 
I have been playing around with this for awhile. Then I went back to looking at e like this..
1+(1/n)^n. It seems like if you multiply n by 2 you get a very good approximation for what we were playing around with earlier.
View attachment 39211
Any thoughts?
Edit. It should be the n-2 that gets divided by 2. Sorry

Whether we have [imath] n\, , \,n/2 [/imath] or [imath] (n-2)/2 [/imath] only matters for small values of [imath] n. [/imath] We get [imath] e [/imath] on the right for large [imath] n [/imath] in any of these cases.

If I use [imath] \pi_0(x)=x/ \log(x) [/imath] then I get [imath] e [/imath] on both sides for [imath] n\to \infty [/imath], as before. Your formula
[math] \pi_1(x)=\dfrac{1}{\log(x)-e^{1/\log(x)}} [/math] is more or less identical to [imath] x/\log(x) [/imath] and has the same behavior for very large values of [imath] x. [/imath] This means that there are two possibilities: a) We need a theoretical explanation of where this correction term in the denominator comes from, or b) your formula is a better approximation than the known ones for small values of [imath] x. [/imath]

Let us set [imath] c=e^{\frac{1}{\log(x)}} .[/imath] Then the ratio between your and the known formula is
[math] \dfrac{\pi_1(x)}{\pi_0(x)}=\dfrac{1}{1-\dfrac{c}{\log(x)}} [/math] which converges to one, i.e. the relative error of your formula becomes marginal. However, if we calculate the difference between both formulas, then we get [math] \pi_1(x)-\pi_0(x) =\dfrac{x\cdot c}{\log(x)(\log(x)-c)}\sim \dfrac{x}{\log^2(x)} [/math] for large values of [imath] x. [/imath] Hence, the absolute error becomes larger and larger.

There is a nice list of actual values from [imath] x=10 [/imath] to [imath] x=10^{29} [/imath] on Wikipedia. I will link the German version (scroll to the right) because it also contains a column for a fixed value of [imath] c=1.08366 [/imath] which corresponds to roughly [imath] e^{1/\log(250,000)}. [/imath] The English version is similar, but without [imath] \pi_2(x)=\dfrac{x}{\log(x)-1.08366} [/imath] and without links to https://oeis.org/ where the data were taken from. These data should give you a comparison with your function. Note that the decimal separating signs in German are the other way around:
[math] \text{Engl.:}\;84,367.12345 \quad \text{Germ.:}\;84.367,12345[/math]
 
Last edited:
Whether we have [imath] n\, , \,n/2 [/imath] or [imath] (n-2)/2 [/imath] only matters for small values of [imath] n. [/imath] We get [imath] e [/imath] on the right for large [imath] n [/imath] in any of these cases.

If I use [imath] \pi_0(x)=x/ \log(x) [/imath] then I get [imath] e [/imath] on both sides for [imath] n\to \infty [/imath], as before. Your formula
[math] \pi_1(x)=\dfrac{1}{\log(x)-e^{1/\log(x)}} [/math] is more or less identical to [imath] x/\log(x) [/imath] and has the same behavior for very large values of [imath] x. [/imath] This means that there are two possibilities: a) We need a theoretical explanation of where this correction term in the denominator comes from, or b) your formula is a better approximation than the known ones for small values of [imath] x. [/imath]

Let us set [imath] c=e^{\frac{1}{\log(x)}} .[/imath] Then the ratio between your and the known formula is
[math] \dfrac{\pi_1(x)}{\pi_0(x)}=\dfrac{1}{1-\dfrac{c}{\log(x)}} [/math] which converges to one, i.e. the relative error of your formula becomes marginal. However, if we calculate the difference between both formulas, then we get [math] \pi_1(x)-\pi_0(x) =\dfrac{x\cdot c}{\log(x)(\log(x)-c)}\sim \dfrac{x}{\log^2(x)} [/math] for large values of [imath] x. [/imath] Hence, the absolute error becomes larger and larger.

There is a nice list of actual values from [imath] x=10 [/imath] to [imath] x=10^{29} [/imath] on Wikipedia. I will link the German version (scroll to the right) because it also contains a column for a fixed value of [imath] c=1.08366 [/imath] which corresponds to roughly [imath] e^{1/\log(250,000)}. [/imath] The English version is similar, but without [imath] \pi_2(x)=\dfrac{x}{\log(x)-1.08366} [/imath] and without links to https://oeis.org/ where the data were taken from. These data should give you a comparison with your function. Note that the decimal separating signs in German are the other way around:
[math] \text{Engl.:}\;84,367.12345 \quad \text{Germ.:}\;84.367,12345[/math]
Oh thanks for the quick reply. I will delve into it in a bit. But first I think I found a way to count the primes simply using e=(1+1/x)^x.
IMG_3296.jpeg
Obviously it isn’t very efficient but if it’s correct it’s a great way to visualize there growth.

IMG_3293.jpeg
IMG_3294.jpeg
It’s more accurate than x/ln(x) from what I can tell.
 
Oh thanks for the quick reply. I will delve into it in a bit. But first I think I found a way to count the primes simply using e=(1+1/x)^x.
View attachment 39224
Obviously it isn’t very efficient but if it’s correct it’s a great way to visualize there growth.

View attachment 39229
View attachment 39230
It’s more accurate than x/ln(x) from what I can tell.

What does it represent? Is it the number of primes between [imath] e^{17} [/imath] and [imath] e^{18} [/imath]?

I would, and perhaps I will, not quite sure yet, download the list on Wikipedia into an Excel file, and add further columns with the values for [imath] \pi_1(x)=\dfrac{1}{1-e^{1/\log(x)}} [/imath] and the differences to the other formulas, plus the relative deviations and directly compare all of them.

You lost me a bit with your numbers as I'm not quite sure what they represent.
 
What does it represent? Is it the number of primes between [imath] e^{17} [/imath] and [imath] e^{18} [/imath]?

I would, and perhaps I will, not quite sure yet, download the list on Wikipedia into an Excel file, and add further columns with the values for [imath] \pi_1(x)=\dfrac{1}{1-e^{1/\log(x)}} [/imath] and the differences to the other formulas, plus the relative deviations and directly compare all of them.

You lost me a bit with your numbers as I'm not quite sure what they represent.
Yes I apologize. I got ahead of myself and didn’t scrutinize my work hard enough. Sorry about that. Thanks again for everything. We respond when I can.
 
There is a nice list of actual values from x=10 x=10 x=10 to x=1029 x=10^{29} x=1029 on Wikipedia. I will link the German version (scroll to the right) because it also contains a column for a fixed value of c=1.08366 c=1.08366 c=1.08366 which corresponds to roughly e1/log⁡(250,000). e^{1/\log(250,000)}. e1/log(250,000). The English version is similar, but without π2(x)=xlog⁡(x)−1.08366 \pi_2(x)=\dfrac{x}{\log(x)-1.08366} π2(x)=log(x)−1.08366x and without links to https://oeis.org/ where the data were taken from. These data should give you a comparison with your function. Note that the decimal separating signs in German are the other way around:
Finally have some time to go through your msgs. Still going over your math. But as for this yes I’m aware of the wiki page and for awhile I was only doing calculations up to 10^29. But me with my prime density obsession lol needed more. Hence my change to Li on wolfram. As for the sequence site I love it. I use it all the time. My favourite sequence I came up with so far is 2,6,15,28,55…. Great for counting primes. Spent months trying to figure out how to kind of factorialize that sequence. But to no avail.

Currently I’m still messing around with this formula…
IMG_3288.jpeg
IMG_3287.jpeg
As you can see it works very well. Still trying to figure out how to count the primes not just between powers of e. Does get very messy but it looks like it involves both multiplication and addition. Which I find very interesting.
Once again sorry for the confusion on some of my numbers. You got a glimpse into my confused mind.
 
of c=1.08366 c=1.08366 c=1.08366
This looks like legendres constant. I’m not going to google if it is or how to spell his name so hopefully I’m correct on both. If you watched my vids on using the golden ratio for prime density I was so excited thinking I found something so interesting only to find out I just made my own constant. Pretty disappointed but also happy to know I made the same mistake legendre made. Lol
 
I would love to see my formula like this for comparison…
View attachment 39247

Also probably going to make a follow up vid soon. Want to give you credit for your contributions. As of now I will just call you my online math amigo. Is there something else or your name that you would like me to use?

Lol. My name is Stefan, but you can use "fresh_42" which I used for meanwhile almost 20,000 posts in almost 10 years and nearly 40 articles on Physics Forums. A lot of almosts, I just notice.
 
Lol. My name is Stefan, but you can use "fresh_42" which I used for meanwhile almost 20,000 posts in almost 10 years and nearly 40 articles on Physics Forums. A lot of almosts, I just notice.
I think I fingered out a way to use (1+1/x)^x to count the primes. I have used this technique and it works all they way up to the point you see here….
IMG_3322.jpeg
The amount of primes between e^14 and e^15 is
141748
Using x/ln(x) you get
132934
This works for at least up to this point. But before I spent my whole day doing calculations seeing if if holds true for high values I thought I would ask you. I figure you could probably figure it out in a matter of minutes. Any thoughts?
 
This is the exaggeration of the day. I need to think about it. I have an idea but I don't know whether it will work.
That was not a very Fermat response. You should have said something like… well I’m kind of busy at the moment. Finishing up my prove for the p vs np problem. But if I have a minute or two later on I will peruse over it.
 
Does it stop at [imath] 7 [/imath] or does it go up to infinity?

It would also be helpful to calculate the gaps between powers of [imath] 10 [/imath] as we have exact data for the actual number of primes from that Wikipedia list.
 
Does it stop at [imath] 7 [/imath] or does it go up to infinity?

It would also be helpful to calculate the gaps between powers of [imath] 10 [/imath] as we have exact data for the actual number of primes from that Wikipedia list.
I have no idea if it goes to infinity. I ran out of time lol. Yes power of tens would be better. No idea how to go about that though.
 
Yes power of tens would be better. No idea how to go about that though.
If I understand your calculations correctly, then your proposal is
[math] P(x)=\prod_{k=1}^{[x]}\left(1+\dfrac{1}{k/2}\right)^{k/2}\sim \pi\left(e^{[x]+1}\right)-\pi\left(e^{[x]}\right) [/math]At least, your figures for [imath] P(14) [/imath] suggest this, modulo a typo, [imath] \dfrac{e^{15}}{15}-\dfrac{e^{14}}{14}=132034. [/imath] And if so, then we could use any value for [imath] x [/imath] and get the numbers for powers of ten this way: [imath] x=n\log(10) [/imath] so [imath] e^x=10^n. [/imath]

Plus I couldn't verify the number of actual primes in that range.
 
Last edited:
... and me stupid asked with [imath] \pi(e^{15}) [/imath] what worked well for small numbers, but resulted in [imath] \pi \cdot e^{15} [/imath] for large numbers. I haven't had the idea to phrase it verbally. :cry:

I tried the formula for powers of ten but the error margins of [imath] x=n\log 10 [/imath] to the next integer are too big. I'm currently trying to rewrite [math] P(x)=\prod_{k=1}^{[x]}\left(1+\dfrac{1}{k/2}\right)^{k/2} [/math] or the logarithm of it to be exact. It led me to the Hurwitz zeta function and is not that easy.
 
Last edited:
Intermediate result:

Let [math] P(x)=\prod_{k=1}^{[x]}\left(1+\dfrac{2}{k}\right)^{k/2} [/math]and [imath] L(x)=\log P(x). [/imath] Then (deduction follows when I finish my work or get stuck)
[math] L(x)=\dfrac{\log(3)}{2}+\log(2)+[x]-\dfrac{1}{2}-H_{[x]}+\sum_{n=3}^\infty (-1)^{n+1}\dfrac{2^{n-1}}{n}\left(\zeta(n-1,3)-\zeta(n-1,[x]+1)\right) [/math]I needed [imath] n-1>1 [/imath] to use the Hurwitz zeta-function, i.e. [imath] n\ge 3. [/imath]

This isn't likely the "simplification" you spoke about, and it will get worse when I replace the Hurwitz zeta-function by its integral expression and the harmonic number by [imath] H_{[x]}=\log [x] +\gamma +\mathcal{O}(1/[x]) [/imath] with the Euler-macaroni, sorry, Euler-Mascharoni constant [imath] \gamma [/imath] or by an integral, too.
 
Top