# Thread: Seeking Help with a Calculation

1. Hello folks. Newbie here. I hope this is the right place to post my question.

I'm trying to do a calculation and find it's beyond me. Here's the challenge.

Let S be the set of all primes up to P.
Let P! be the product of the primes in S.

For incrementally increasing values of P I want to calculate the square root of P! and estimate the quantity of primes between P and sqrtP! Then I want to add the reciprocals of those primes. Call this final result Rs (sum of reciprocals)

An exact figure is not required. I want to figure out where Rs is going as P increases.

Example. Where P = 7

P! = 210
Sqrt P! = 14-ish
Rs = 1/11 + 1/13

The range P to sqrtP! increases rapidly, and the only way to check how many primes there are in this range seems to be to look it up. But maybe there's a rough and ready method that would at least show the trend for Rs.

Can anyone help with this? If the question is not clear then my apologies.

I should add that I am not a mathematician so please keep it simple.

Many thanks.

2. Originally Posted by PeterJ
Hello folks. Newbie here. I hope this is the right place to post my question.

I'm trying to do a calculation and find it's beyond me. Here's the challenge.

Let S be the set of all primes up to P.
Let P! be the product of the primes in S.

For incrementally increasing values of P I want to calculate the square root of P! and estimate the quantity of primes between P and sqrtP! Then I want to add the reciprocals of those primes. Call this final result Rs (sum of reciprocals)

An exact figure is not required. I want to figure out where Rs is going as P increases.

Example. Where P = 7

P! = 210
Sqrt P! = 14-ish
Rs = 1/11 + 1/13

The range P to sqrtP! increases rapidly, and the only way to check how many primes there are in this range seems to be to look it up. But maybe there's a rough and ready method that would at least show the trend for Rs.

Can anyone help with this? If the question is not clear then my apologies.

I should add that I am not a mathematician so please keep it simple.

Many thanks.
Hi PeterJ and welcome to MHB! For someone who is not a mathematician you have certainly come up with a challenging problem.

In fact, there are several asymptotic results about numbers and sums of primes (in other words, approximate estimates for what happens when the numbers become large).

The product of all the primes up to $P$ is called the of $P$, denoted by $P\#$, and it is approximately equal to the exponential $e^P$ when $P$ is large. Its square root is therefore approximately $e^{P/2}$.

The number of primes less than $N$ is given by the as approximately $\dfrac N{\log N}$. (The logarithm here is the natural logarithm, the log to base $e$.) So the number of primes less than $\sqrt{P\#}$ is approximately $\dfrac{e^{P/2}}{P/2}= \dfrac{2e^{P/2}}P.$ The number of primes in the interval from $P$ to $\sqrt{P\#}$ is then approximately $\dfrac{2e^{P/2}}P - \dfrac P{\log P}.$

Finally, there is also an asymptotic formula for the of all the primes less than $X$, namely $\log\log X.$ So the sum of the reciprocals of primes in the interval from $P$ to $\sqrt{P\#}$ is approximately $\log\log\bigl(e^{P/2}\bigr) - \log\log P = \log(P/2) - \log\log P.$ Since $\log\log P$ is much smaller than $\log P$, a crude estimate for $Rs$ would be that it is of the order of $\log P$ when $P$ is very large.

Thanks Opalg. This is very helpful. I cannot follow the calculations properly but I see the idea.

So I can use log P as an estimate for the primes in Rs. Just what I wanted to know. Many thanks.

I'm thinking now that I can roughly calculate Rs by taking the average of the reciprocals of the smallest and largest primes in the range and multiplying by log P. Does this make sense? If so I'm sorted.

As usual I replied too hastily. It was a great answer but I realised later that I didn't fully understand it. Then I realised that I may be over-complicating things. Is what follows correct?

The product of the primes up to P is very soon so large compared to P that I might as well forget the primes below P. In this case all I need is an estimate for the quantity of primes up to P! using the PMT, which I imagine is an easy calculation. Lets call this Q.

Then I would pick a number in the middle of the range P to P! and multiply its reciprocal by Q for a very rough estimate of the sum of the reciprocals of the primes up to P!.

Then I would deduct the reciprocals of primes below P from this, and this would give me a very rough estimate for the sum of the reciprocals of the primes in Rs (the range P to P!).

Is this about right in principle?

If it is lunacy feel free to say so.

Thanks.

5. Originally Posted by PeterJ
The product of the primes up to P is very soon so large compared to P that I might as well forget the primes below P. In this case all I need is an estimate for the quantity of primes up to P! using the PMT, which I imagine is an easy calculation. Lets call this Q.
That is correct: $P!$ (which I call $P\#$) is so huge compared with $P$ that you can effectively ignore what happens below $P$. The estimate in my previous comment for $Q$ (the number of primes below $\sqrt{P\#}$) is that it is approximately $\dfrac{2e^{P/2}}P$.

Originally Posted by PeterJ
Then I would pick a number in the middle of the range P to P! and multiply its reciprocal by Q for a very rough estimate of the sum of the reciprocals of the primes up to P!.

Then I would deduct the reciprocals of primes below P from this, and this would give me a very rough estimate for the sum of the reciprocals of the primes in Rs (the range P to P!).
In your initial post, you said that you wanted the primes between $P$ and $\sqrt{P\#}$. Now you are asking for the range from $P$ to $P\#$. I'll stick to the square root case, but if you want it without the square root that can be done too.

You don't need to estimate the sum of reciprocals of the primes in that range by taking an "average" prime in that range and multiplying by the number of primes. That would not be accurate enough to give you a valid estimate. My previous post gave a better estimate for that sum of reciprocals, namely that it is approximately $\log P.$

Originally Posted by Opalg
That is correct: $P!$ (which I call $P\#$) is so huge compared with $P$ that you can effectively ignore what happens below $P$. The estimate in my previous comment for $Q$ (the number of primes below $\sqrt{P\#}$) is that it is approximately $\dfrac{2e^{P/2}}P$.

In your initial post, you said that you wanted the primes between $P$ and $\sqrt{P\#}$. Now you are asking for the range from $P$ to $P\#$. I'll stick to the square root case, but if you want it without the square root that can be done too.

You don't need to estimate the sum of reciprocals of the primes in that range by taking an "average" prime in that range and multiplying by the number of primes. That would not be accurate enough to give you a valid estimate. My previous post gave a better estimate for that sum of reciprocals, namely that it is approximately $\log P.$
Oh yes. I meant P to P#.

Right. I think I get this now. This is the exact answer I needed so many thanks. I'll give it some more thought but I may be sorted now. Much appreciated...

Thank you for your very clear replies, Opalg.

Now you've helped me simplify the problem I was able to find a table online. Here's my attempt to do the calc.

The 500th prime is 3571

The sum of the reciprocals of the primes to 3571 is 2.365328

3571 is the is the square root of 12752041, which is a bit larger than P# where P is 19.

So, roughly speaking, where P=19 I would need to deduct the sum of the reciprocals of 2,3,5,7,11,13,19 from 2.37 to give the sum of the reciprocals of the primes between P and sqrtP#.

Is this about right so far? The result doesn't have to be correct, I just need to get to an approximation. This seems to be a start, although I know there are still some complications.

I am trying to calculate the chances of a prime product landing at P#+/-1, or. rather, how the odds of this change as P grows larger. It seems to me the odds fall. This is because despite the massive increase in the number of possible prime divisors in the range P to sqrtP# for each step increase in P, the new P is the largest of them by far, so taking it out of the sum more than offsets the sum of all the tiny reciprocals that are being added each time.

Does this make sense? I might be way off.

Hmm. No more replies so maybe I've gone off-piste.

I'll leave this one and come back with an updated and more clear question on a new thread.

Thanks.