This probably isn’t a real good way to figure out primes, but it’s something I’ve wondered about for a while and I thought some of the math experts here might know more about it.
If you take the function:
sin((x-p) * pi/2p)
where p is a prime number, you’ll get a function which is equal to zero whenever x is odd and a multiple of p. For example:
sin((x-3) * pi/6) is 0 at 3, 9, 15, 21, …
sin((x-5) * pi/10) is 0 at 5, 15, 25, 35, …
sin((x-7) * pi/14) is 0 at 7, 21, 35, 49, …
These functions avoid the even multiples of a number since I was just wanted to find odd numbers. So just 3,9,15,21 instead of 3,6,9,12,15,18,21.
Given the three equations above, the way to figure out the next prime would be to find the odd value of x greater than the greatest prime we already know (7) where all the known equations do not equal 0. For example, 9 is out because the equation for 3 is zero at 9. The next value that works is 11. None of the above equations equal 0 for x=11. Furthermore, all the odd values of x between 11 and 33 (11 + 2*11) which do not evaluate to 0 from all the known equations will also be prime. If you graph out the three equations above you’ll see this as the x values between 11 and 33 where no sine curve goes through it.
There’s not any magic going on here since essentially all that’s happening is that the prime multiples are being scratched off the x axis. Figuring out primes this way would not be very efficient. You’d have one equation for each number and it’d be much simpler to just do the straight division.
But the thing I was wondering is if all the equations can be combined somehow into one equation that can be used to iteratively figure out the next prime. For example, knowing that 3,5,7, and 11 are prime, can a single equation be created which equals 0 at all those values and all multiples of those values. Like in this made up equation:
sin( (x - 35711 ) * pi/(2357*11))
(That’s not the right equation, but hopefully you get the idea.)
So as I figure out each successive prime, I tweak the single equation to include that prime. This would give me an efficient mechanism to find all the prime numbers up to some maximum.
So anyway, I was wondering if there’s anything to all that. I’m not a math expert so feel free to tell me I’m bonkers.