• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

Distributions of Primes

Jarhyn

Wizard
Joined
Mar 29, 2010
Messages
14,504
Gender
Androgyne; they/them
Basic Beliefs
Natural Philosophy, Game Theoretic Ethicist
Ok, another weird thread documenting my strange journey through number theory: Exactly How many primes are there in a region of numbers?

This is a strange one and requires a visualization of the patterns that exist in the Sieve of Eratosthenes to understand. Also, I might add, I wasn't expecting this but I started getting vibes from the movie Pi.

For a given N, lets ask "how many primes are there less than".

Lets start with 4.

1647736897349.png

I've graphed out some iterations of sin(x*pi/P)/n(P) By counting all primes mapped (1 of them, not counting "1"), we get a number: 3-1.

Lets estimate the number of primes, then, under 12. For that, it looks like the number is 7-1. so, 6.

That's wrong though. It's off by 1.

It breaks down once the calculation reaches the first square of the first prime that is not exactly known: 9.

1647736027109.png
Now, as you can see, I've added another line. This represents another step: reducing the error.

To reduce the error, you need to find the COUNT of cross products and power products. To do this, I start squaring primes, and for every square and cross product less than 12, I can subtract 1 from my estimation. So, 6-1 is 5. Hooray, I have corrected my error.

There are 5 primes under 12, and 4 remaining lines. For regions above 12, it appears that there are "about" 4 primes per segment.

Between 0 and 60, there are "about" 5+4*(5-1) primes. so 21. This is wrong though. It's off by a few.

To correct the error, we need to figure out a couple more primes, though that's easy because the tool we use to get the estimate has already revealed them in it's pattern because this system will always locate all primes quickly under (highest solved)^2. To know how many primes worth of error we have exactly, we need to know the last prime less than square root of 12, which is 3. There is only one of them, so our error is 1.

I can then say "primes 5 and 7, but not 11, square less than 60." This is 2, with a single cross product, so 3; My estimate is wrong by 3. 21-3 is 18. There are 18 primes under 60. I don't really know what they are. For using this system to find out how many primes are OVER 60, however, I'm going to only subtract 5 and its powers under 60, which is 2. Why? Because I haven't gotten to 420 yet, and this describes my estimator for this epoch. so while I know there are exactly 18 primes under 60, I'm going to estimate that there are 16 primes for every region over 60.

Lets estimate using this count out to 420! 18+16*(7-1) gives us roughly 114. But there's an error again
Now our corrective primes do not include 5: We have accounted for this with our "exact count under 60." To resolve the error, we need to again subtract an exact number of primes' cross products and powers. To do this we are going to subtract from our inaccurate estimate "primes greater than 5 whose cross products are less than 420". This means calculating all primes again whose squares are less than 420, and then counting their cross products less than 420. I know the primes in question are 7, 11, 13.
7*7, 11*7, 13*7, 11*11, 11*13, 13*13.

In this part of the problem it is factorial. It will not exactly remain this way: This table becomes large, as if one of the primes in this epoch were to have a square whose product with another prime in the epoch is less than the target number, that also would be an error term. It isn't yet, but it will be. To fix this, we will have to add every "power" of a prime, in addition to the primes themselves, whose value is less than the greatest prime whose square is less than the doubled primorial being observed to the list of "error terms to cross-productize".

at any rate, we have identified our error as 6. There are exactly 108 primes less than 420. Again, because I haven't gotten to 4620 yet, I'm again only going to correct it for 7. This is again because this is where the pattern repeats exactly on the sieve. There are THREE powers of 7 less than 420, so 3. so while there are exactly 108 primes less than 420, for every region OVER 420, there are going to be "about" 108-3, so 105.

Lets do 4620. There are 108 primes less than 420, and for every region of 420 numbers greater than, there are "about" 105 primes. That's going to be about 108+105*(11-1) =1158...
 

When I looked at prime numbers what stood out wasthat it looked like a 1st order differential equation impulse response. In electrical terms a low pass filter.

I thought it might be possible to dervise a cmplex S doman function to derive a frequncy response. The scale factor being Nprimes/dx.
 

When I looked at prime numbers what stood out wasthat it looked like a 1st order differential equation impulse response. In electrical terms a low pass filter.

I thought it might be possible to dervise a cmplex S doman function to derive a frequncy response. The scale factor being Nprimes/dx.
Now here's the kicker: I'm pretty sure I see a model of operation here somewhere which would not just count them but to also locate the primes it has "counted" this way, since lower primes are tabled out by the repetition of 2*primorial. The sequence at 2*primorial that predicts inaccurately can be made accurate by operating a filter sieve on the higher order primes separate from the lower sieve. Then the intersection of those sieves can be used to create an even larger filter on their 2*primorial base.

In this way, reducing the previous field of solutions sequentially allows fast calculation of the lower region of the progression and (slightly less onerous) calculation of the higher region of the progression.
 
I don't see where sine comes in. Sin(N*x) represents harmonics which is what you plotted.

I assume difference tables have been calculated. Does that lead anywhere?
 
I don't see where sine comes in. Sin(N*x) represents harmonics which is what you plotted.

I assume difference tables have been calculated. Does that lead anywhere?
Ok, so, I haven't calculated much of anything? The sin(x*pi/n) was to visualize the Sieve of Eratosthenes as a mechanical interaction, so I could see where the patterns were: it let me count the primes without having to actually look at them.

Primes are, fundamentally, harmonic in their operation.

Look at all locations where the line on sin(x*pi) cuts on either graph uniquely: they are prime. Eventually there is a harmonization where patterns of primes will repeat (with growing error).

The error is only ever extant at (lowest unpatterned prime)^2, and can be calculated by finding the powers of all primes under (2*primorial) under (2*primorial) plus all primes under (2*primorial), and finding their cross products. The error calculation in "primes under" doesn't require finding the cross products just counting how many there are, which is an easier ask.
 
I don't see where sine comes in. Sin(N*x) represents harmonics which is what you plotted.

I assume difference tables have been calculated. Does that lead anywhere?
Ok, so, I haven't calculated much of anything? The sin(x*pi/n) was to visualize the Sieve of Eratosthenes as a mechanical interaction, so I could see where the patterns were: it let me count the primes without having to actually look at them.

Primes are, fundamentally, harmonic in their operation.

Look at all locations where the line on sin(x*pi) cuts on either graph uniquely: they are prime. Eventually there is a harmonization where patterns of primes will repeat (with growing error).

The error is only ever extant at (lowest unpatterned prime)^2, and can be calculated by finding the powers of all primes under (2*primorial) under (2*primorial) plus all primes under (2*primorial), and finding their cross products. The error calculation in "primes under" doesn't require finding the cross products just counting how many there are, which is an easier ask.
Observe, in the 12 pattern sequence including "3" as a line, look how many unique zeroes there are. For "three given primes", there are exactly four places where only sin(x*pi) zeroes. Hence this is what is used to create the estimate, and what defines the growth of the error term, namely the exclusion of "5" when we surpass 25, it's square. As you will note the error is 0 under 25, because the sequence of 12 doubles perfectly to 24.
 
so, @steve_bank @Swammerdami I'm taking a look at building the error/difference table for this, but I was playing around today to see if I could gin up a function that would essentially "be zero if prime", but I could not. The best I could do today was a function that would "be not zero if prime and not counted less than the square of the first uncounted prime": (1-(cos(2pi*x/z(1)))*(1-(cos(2pi*x/z(2)))... Notably this misses on "1"...

For example, If I were to graph (1-(cos(2pi*x/2))*(1-(cos(2pi*x/3)), the zeroes of this particular function exist at all real non-prime numbers less than 5^2, and at the points of all primes less than and equal to 3. The error rate builds as per OP.

So I can coerce this thing into spewing "isn't prime" but I can't coerce it to spitting out "is prime". Interestingly this does check each number for primeness exactly once, and it can calculate WHETHER a number is prime within a margin of error determined by n by just setting x.

Essentially if (1-(cos(2pi*x/2))*(1-(cos(2pi*x/3))*...(1-(cos(2pi*x/2))*(1-(cos(2pi*x/z(n))) for x = 0, where z(n) >= sqrt(z), x is not prime, and for each prime less than, if (1-(cos(2pi*x/z))=0 that number is not a factor.

This is all a fact because 1-(cos(2pi*x/2) is really just (start a roller at 0, track the height of the peg, whose full period is 2), and so this is really just a clever Sieve of Eratosthenes that perfectly builds the "lookup table" using waveforms.

Ideally, I would coerce this thing so that at all original zeroes, the value is imaginary, and at all the original non-zero points, be zero.
 
\(x\prod_{n=1}^{2\cdot3}\left(1-\frac{\left(\frac{\pi x}{2}\right)^{2}}{n^{2}\pi^{2}}\right)\)
I did a bit of reading and figured out in some respects how to operate the infinite product operators and some googling to find out how to express product expansions properly so as to converge on sine.

This allowed me to express a finite product which will, without error, express for a given finite region the number of primes expressed by the number of iterations of this that are themselves productized. I'm not sure how to simplify such expressions yet, so anyone who can explain this, I'm all ears.

This yields results like as follows, which will predict all primes less than 7^2. Apparently by messing with the index, you can make the function not actually nuke out primes when they are counted. Hooray.
\(x\prod_{n=2}^{\frac{7^{2}}{2}}\left(1-\frac{\left(\frac{\pi x}{2}\right)^{2}}{n^{2}\pi^{2}}\right)\cdot x\prod_{g=2}^{\frac{7^{2}}{3}}\left(1-\frac{\left(\frac{\pi x}{3}\right)^{2}}{g^{2}\pi^{2}}\right)\cdot x\prod_{b=2}^{\frac{7^{2}}{5}}\left(1-\frac{\left(\frac{\pi x}{5}\right)^{2}}{b^{2}\pi^{2}}\right)\)
So this, with each product taken to the infinite product and index = 2 will zero at all non-prime numbers.

This will also be true of the infinite product of these NOT using primes, I think? Since all non-prime numbers will invoke zeroes since it's a product on those zeroes.

I'm pretty sure this is expressed by \(x\prod_{b=2}^{\infty}\left(x\prod_{n=2}^{\infty}\left(1-\frac{\left(\frac{\pi x}{b}\right)^{2}}{n^{2}\pi^{2}}\right)\right)\)

I'm fairly certain for all finite iterations of the product, this system is nonzero at all primes (though the range of these ends up having to be bounded differently for each piece of the product), but I'm not sure if it converges to a line at zero in the infinite product, and it only goes up to (next prime squared).

If I could figure out how to coerce my "always positive cosine function version" from the previous post into an infinite product like this, I'm pretty sure it would not converge to zero?

This should simplify too, since it's an infinite product of an infinite product which should itself be... merely an infinite product.?
 
Last edited:
After some consideration, it seems that any such infinite product must converge to zero, as the slope of a wave converges to zero at infinite wavelengths, and the system is created though an infinite product.

So while it is possible for bounded products to indicate primes, it is impossible for unbounded products to indicate them.

You can't multiply it by infinity to get it away from zero.

You can't take it's square root to get it away from zero into I even if it were "negative cosine version": the Riemann sphere places 0 at a convergence from I all the same, so it still converges to zero.

You can't multiply it by any finite amount.

You can't divide by it.

You can't square it.

It is purely and eternally guaranteed that any thing built out of the sieve of Eratosthenes to the infinite end of that process must converge to zero.

So while there are an infinitude of primes they must become infinitely difficult to compute as prime{N} approaches infinity, at least in this way.

Edit: if you could find a cosine* function which mutates a sine wave into a more progressively square wave at the top and a narrowing dive to zero at the zeroes such that it converges to a discontinuity between 0 and 1... That would do it.
 
Last edited:
So I wanted to play with using the Fourier Expansion to create square waves that start at zero and then pass through the second, third, fourth, fifth, etc indexes. of the sine wave rather than the first.

Unfortunately, the Fourier expansion doesn't seem to want to play nicely with the first index. I might have to disjoint it or run the Fourier Expansion differently across the first iteration?

But it still converges towards less.

I expect that I could make it converge towards infinity at non-zero points? If I could do that, it would mean that I would have difference between 0 and infinity in the function, but then, 0 times "convergence to infinity" appears not-well-defined? It may result in a nonzero value there. And infinite sums and products themselves may converge to natural numbers so again, I can let go that way.

This means that the only seemingly possible solution at infinite scales requires a function whose shape (for the 2-wave) is continuous between 0 and 4, and only discontinuous after that at every even integer, and 1 and -1 at all other points.

At that point you could adjust the period on your index from 2 to infinity as your variance of infinite product and you would have a "prime selection function" for all primes and their counts.
 
So I did some experimentations with infinite sums of a finite integration of Heaviside's step function, as h(0) = 0.

I was able to get it to bound down to 0 and progressively move to narrowing 0's and higher values of K while still well bounded between 0 and 1.

This supplies my "2 line".

I now need to work on getting the periodicity controlled variably so that I can infinitely productize it.

Ideally I'll also make it reflect on '0'.

Strangely, the Heaviside convergent square wave is going to be generated by an infinite sum rather than infinite product.

I dunno what's going to happen when I try to simplify this monstrosity... If it can be simplified.
 
TIMG_20220415_192145_498.jpg

So, I managed to coerce a binary square wave out of the Heaviside Step Function that converges to a square wave without the messiness of the sine convergence.

By squaring the wave function, I'll get "narrowing instantaneous zeroes" like I wanted as K approaches infinity, and peaks approaching 1 as k approaches infinity.


Now for hitting it with an infinite product function between whole number width expansions, and I will have an infinite function that only zeroes on all nonprimes.
 
\(\prod_{v=1}^{g}\left(\left(1-\frac{2}{1+e^{\left(2g\left(x\right)\right)}}\right)^{2}\ \cdot\prod_{n=1}^{g}\ \left(1-\frac{2}{1+e^{\left(\left(2g\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)^{2}\right)\)

@lpetrich @Swammerdami, either of you folks know how I can simplify this monstrosity?

This seems to have done the trick. As g approaches a limit of infinity, this reveals all primes.

This is a combination of the Heaviside Step function, as an infinite product of an infinite product. I've adjusted it to index from 1, could adjust it to index from 0, and I could probably also make it symmetrical, but I'm not going to do any of those things.

I could probably also make it skip "1", but I'm also not going to do that. It's like one extra term.

edit: I lied. I added the terms. Also realized I could move the bit out of the product and lose nothing.
\(\left(\left(1-\frac{2}{1+e^{\left(2g\left(x\right)\right)}}\right)\left(1-\frac{2}{1+e^{\left(2g\left(x-1\right)\right)}}\right)\prod_{v=1}^{g}\left(\prod_{n=1}^{g}\ \left(1-\frac{2}{1+e^{\left(\left(2g\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)\right)\right)^{2}\)
 
Last edited:
\(\prod_{v=1}^{g}\left(\left(1-\frac{2}{1+e^{\left(2g\left(x\right)\right)}}\right)^{2}\ \cdot\prod_{n=1}^{g}\ \left(1-\frac{2}{1+e^{\left(\left(2g\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)^{2}\right)\)

@lpetrich @Swammerdami, either of you folks know how I can simplify this monstrosity?

This seems to have done the trick. As g approaches a limit of infinity, this reveals all primes.

This is a combination of the Heaviside Step function, as an infinite product of an infinite product. I've adjusted it to index from 1, could adjust it to index from 0, and I could probably also make it symmetrical, but I'm not going to do any of those things.

I could probably also make it skip "1", but I'm also not going to do that. It's like one extra term.

edit: I lied. I added the terms. Also realized I could move the bit out of the product and lose nothing.
\(\left(\left(1-\frac{2}{1+e^{\left(2g\left(x\right)\right)}}\right)\left(1-\frac{2}{1+e^{\left(2g\left(x-1\right)\right)}}\right)\prod_{v=1}^{g}\left(\prod_{n=1}^{g}\ \left(1-\frac{2}{1+e^{\left(\left(2g\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)\right)\right)^{2}\)
\(J\left(x\right)=\left(\left(1-\frac{2}{1+e^{\left(2g\left(x\right)\right)}}\right)\left(1-\frac{2}{1+e^{\left(2g\left(x-1\right)\right)}}\right)\prod_{v=1}^{g}\left(\prod_{n=1}^{g}\ \left(1-\frac{2}{1+e^{\left(\left(2g\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)\right)\right)^{2}\)

I was going to say I'm bad at this, but I'm curious if that's just the imposter syndrome talking at this point.
 
Last edited:
I have no idea what yiuare trying to get at but...

A step function by definition is a tertcal instantaneous changee from one state to another, and it does not exist in physical reality. A zero time step requires and infinite number of terms in a Fourier series, or infinite energy.

A uni step is not a square or rectangular wave

There is a proof that guarantees for any function there is one ad only one Fourier series and vice versa. So if you are trying to construct a square wave for specific zeros in a sine wave there is only one set of sine waves for a square wave.

A square wave is a special case of rectangular;ar waves. By varying the duty cycle of a rectangular wave you can vary the Fourier series frequency content. A square wave is a rectangular wave with a 50% duty cycle.

Something from my old archive you can play with creating waveform. The technique in synthesis is to create a function f(x) and take the Fourier Transform, or to create a record of the desired frequencies and phases and taking the inverse transform yielding the function f(x).. It is almost never done by direct integration due to complexity. It is done digitally by the FFT.

So if you try to fit a sine series to a square wave it is what is, there is only one series for a square wave.

Scilab script
clear
tmax = 1 // time seconds

_length = 10000 // time record legth
dt = tmax/_length
// harmonics
// n _even_odd
// 1 1 all harmonics ramp
// 1 2 odd harmonics square wave
// 2 2 e ven harmonics sawtooh
n = 2
even_odd = 2
_terms = 50
t = 0

for i = 1:_length y(i) = 0;end;
for i = 1:_terms
for j = 1:_length
x(j) = sin(2*%pi*n*t)/n
t = t + dt
end
for k = 1:_length y(k) = y(k) + x(k);end;
n = n + even_odd
end

a = scf(1)
clf(a)
plot(y)
 
I have no idea what yiuare trying to get at but...

A step function by definition is a tertcal instantaneous changee from one state to another, and it does not exist in physical reality. A zero time step requires and infinite number of terms in a Fourier series, or infinite energy.

...
Read the wiki article on the Heaviside step function. https://en.wikipedia.org/wiki/Heaviside_step_function

The idea is to take a function that has a roughly "sigmoid" behavior but which approaches "squareness" with a single point at infinite slope at a "middle value". Which for Heaviside is at 1/2, so I multiply it by two and subtract that from 1, so that it wiggles between 1 and -1 and transitions in each wave at 0. As k, the "squareness" value increases, it goes towards narrowing width, but is still just 0 there.

I manipulated this in such a way to, as lim(k->infinity), productizes infinitely to hold this behavior, and then take its square so that the value is always positive. I realize I didn't need to set the index targets for the infinite sum at the limit of k, specifically; I could have just indicated infinity. But I wanted only a single dependent "infinity" to operate towards.

In some ways this does indicate "infinite energy", because one of the terms in the product (several actually) is a limit as k approaches infinity.

The whole point was to have something that gets insane in a very particular way at infinite values.
 
It's interesting that there's this behavior at 1/2 in the base function I pulled this out of. It is interesting because it creates a line that makes the zeroes of the function really hard to pull out. There's a symmetry of all points around that line in the infinite sum that generates it as K approaches infinity. Is this "the critical line"? It would explain why the zeroes have to be symmetrical up and down, left and right: Because the slope is infinite across that region.
 
\(lim_{k\to\infty}J\left(x\right)=\left(\prod_{v=1}^{k}\left(\prod_{n=1}^{k}\ \left(1-\frac{2}{1+e^{\left(\left(2k\right)\left(\frac{x}{\left(v+1\right)}-\left(n+1\right)\right)\right)}}\right)\right)\right)^{2} \)

This is the main equation that I really want to simplify, but I'm not really sure that's even possible. Note the 1-2/... which is modifying the natural centers off of 1/2.
 
Derp, forgot, -k, not like it matters for this, but some crazy shit happens in the nonconvergence of the unsquared result wave otherwise.

\(\left(\prod_{v=0}^{k}\left(\prod_{n=0}^{k}\ \left(1-\frac{2}{1+e^{\left(\left(-2k\right)\left(\frac{x}{\left(v+2\right)}-\left(n+2\right)\right)\right)}}\right)\right)\right)^{2}\)
 
@steve_bank So, long story short, it turns out this gave me a solution to Riemann's and P=NP.

I'm willing to discuss why I'm wrong but I'm also only willing to do so if you're willing to consider my discussion that argues that you are wrong that I am wrong.

Double. Fucking. Factors... Also, a new square wave function!
 
Back
Top Bottom