mersenneforum.org How to get to a prime from the previous prime number (sieve of Eratosthenes rediscovered)
 Register FAQ Search Today's Posts Mark Forums Read

 2021-05-09, 01:12 #1 AddieJ   May 2021 78 Posts How to get to a prime from the previous prime number (sieve of Eratosthenes rediscovered) I found a solution that will calculate each consecutive prime number from the previous prime number. I wrote about it in a humorous blog, but understand that it is actually true. Read about it here: http://www.millieandtheboys.com/i-solved-prime/ How does one verify a math discovery?? Addie
2021-05-09, 01:34   #2
Batalov

"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

232018 Posts

Quote:
 Originally Posted by AddieJ ... but understand that it is actually true.
Now, that is humorous. You got us smiling, thanks!

 2021-05-09, 01:49 #3 AddieJ   May 2021 7 Posts Am I crying Wolf?? Ha Guys, I’m not bluffing. If you read the blog and look at the output files, those are actually calculated using an algorithm. I have all the data to back it up.
2021-05-09, 10:46   #4
ZFR

Feb 2008
Meath, Ireland

3·61 Posts

Quote:
 Originally Posted by AddieJ How does one verify a math discovery??
For starters, one needs something to verify.

2021-05-09, 12:03   #5

May 2021

7 Posts

That's fair. I'll get right to it then!

I've attached the following files:

Millie_Code_Prime_Solver_VB_Notepad.txt - this is the code from VB copy and pasted so that you can see it.

Prime.exe - Try it! If you leave the n and m as the default, it will calculate the first 100 prime numbers and place them into an output text file. You must change the output file location to match where the .exe file is and choose a file name.
Mod note: The .exe has been put in a zip with the password of: password
This is to protect people from accidentally running code from an unknown source on their machine.

output.txt - This is the output when the defaults are left as n = 100 and m = 10000. The first column is counting primes and the 2nd column is the prime number. The second prime number is '3' and the 99th prime number is '523' and everything in between.

I posted a few photos so that you can see I had to boot up my old computer (because that's where I have VB) to grab the VB code and paste it into Notepad. The files on my computer were saved on April 8, 2018, which is the weekend I did this... just to show you that there is truth to this. (The 2003 file was actually saved today, but my old computer doesn't work unless I enter an old date...)

I should add, that I visualize all this in Excel. It's incredible and also reveals why there will always be twin primes!

Verify away :)
Attached Thumbnails

Attached Files
 Millie_Code_Prime_Solver_VB_Notepad.txt (4.4 KB, 107 views) output.txt (1.7 KB, 98 views) Prime.zip (4.9 KB, 86 views)

Last fiddled with by Uncwilly on 2021-05-09 at 20:18 Reason: Change .exe to a zip

 2021-05-09, 12:27 #6 AddieJ   May 2021 1112 Posts You can change the input values to calculate more or less prime numbers (n). Just note that input m needs to get exponentially greater as you choose to calculate more primes. It’s basically a guess at how many “rows” are required and many of them are filled with zeros. If your m isn’t large enough it won’t complete the calculation properly. I’m sure there is a way to streamline this, but my coding skills are very limited.
 2021-05-09, 17:24 #7 slandrum   Jan 2021 California 421 Posts At a quick glance at the code this appears to be a basic implementation of the sieve of Eratosthenes. This is a well known method, and works well to generate very small primes. This is not going to find record sized primes, you won't even find 20 digit primes with this, you will be out of memory and time very quickly.
 2021-05-09, 19:21 #8 Dr Sardonicus     Feb 2017 Nowhere 26·7·13 Posts Looks like a sieve to me. Sieving is useful to eliminate composites with small prime factors from a candidate list, but as a standalone prime-proving method you would have to sieve out by all the primes up to the square root of your candidate, which be prohibitively slow for numbers of any size. Also, I also noticed that a lot of the loops had file reads and writes. I'm no computer expert, but I think even with fairly small numbers, that would tend to slow things down a great deal. Some packages have functions that give the next (probable) prime, such as Pari-GP's nextprime() function. If my understanding is correct, it excludes multiples of 2, 3, 5, and 7 as candidates (for arguments larger than 6, anyway), and applies its BPSW pseudoprime test until it finds a number that "passes" the test. The output is not guaranteed to be prime, but if it is not very large (say a couple hundred decimal digits) Pari's isprime() prime-proving function could then be used to be certain. "Everybody knows" there are infinitely many composite numbers that are BPSW probable primes, but nobody knows how to prove it, and AFAIK not a single example has been produced.
2021-05-11, 00:19   #9

May 2021

7 Posts

Quote:
 Originally Posted by slandrum At a quick glance at the code this appears to be a basic implementation of the sieve of Eratosthenes. This is a well known method, and works well to generate very small primes. This is not going to find record sized primes, you won't even find 20 digit primes with this, you will be out of memory and time very quickly.
So you’re saying Eratosthenes beat me to it, huh? Shucks. You're definitely right… it’s a tedious method and takes a lot of memory. No prize primes here.

2021-05-11, 00:24   #10

May 2021

710 Posts

I posted my Excel worksheet and reposted my VB code file with explanations of how it was programmed. If anyone is interested, you can see a little more into my thinking and how each column of values produces the next prime number.

I don’t know if this is just a backwards way of coming up with a sieving method. It is how I started in the process and then I looked for patterns that could be repeated. I have a note that the rows for the code developed for each column is the previous prime squared (gets large quickly, but there are a lot of wasted zero values). The code itself (by code, I mean the column of values below the blue box number) has a midpoint and mirrors itself back to the start. It grows from the midway point and why I speculate that there will always be twin primes since those “twos” will eventually add to the next prime number.

Btw, a lot of those read and writes within loops was me troubleshooting the process and the final version placed a “ ‘ “ in front so that the program ignores the command. The only write command occurs at each prime number. It is, however, a tedious method of looking at every row to check if the value is ‘zero’ or not.

Anyway, that's all I've got! I will likely take a quiet leave from math forums, but it was fun. :) Good luck finding the BIG ones.
Attached Files
 prime_code.zip (1,009.3 KB, 95 views)

2021-05-11, 00:45   #11
Xyzzy

Aug 2002

43·197 Posts

Quote:
 Originally Posted by AddieJ I will likely take a quiet leave from math forums, but it was fun. :)
Or you could stick around and have fun learning with us!

 Similar Threads Thread Thread Starter Forum Replies Last Post a nicol Miscellaneous Math 0 2020-10-20 14:05 bhelmes Number Theory Discussion Group 43 2018-03-13 01:04 cseizert Programming 8 2016-10-27 05:55 Raman Programming 4 2009-01-19 17:12 jchein1 Homework Help 6 2007-08-27 13:51

All times are UTC. The time now is 23:37.

Sun Jun 26 23:37:25 UTC 2022 up 73 days, 21:38, 1 user, load averages: 0.92, 0.99, 0.91