QB64 Phoenix Edition
Prime pattern 6 +/- 1 - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://staging.qb64phoenix.com/forumdisplay.php?fid=26)
+---- Forum: bplus (https://staging.qb64phoenix.com/forumdisplay.php?fid=36)
+---- Thread: Prime pattern 6 +/- 1 (/showthread.php?tid=577)

Pages: 1 2


RE: Prime pattern 6 +/- 1 - bplus - 07-01-2022

@SMcNeill, I remember an interesting sieving program you developed where you used a certain amount of sieving to find the next prime to sieve a little more for next... that seemed to work pretty well because you weren't testing using the divisible test method which really bogs down the more numbers you cover.


RE: Prime pattern 6 +/- 1 - david_uwi - 07-01-2022

It's a very long time since I wrote that program. It looks a bit complicated, but basically it starts with an array (50 million binary digits - because we are only doing the odd numbers) all the binary digits are initially zero. Then it goes through setting every 3rd digit one then every 5th digit to one then every 7th... It wont do 9 as it is reading the next zero digit in the array (and 9 has been struck out by the 3 sieving).
I use only integer division and +, - (and mod -- is the mod value saved during the integer division in QB64?*).

*I do a lot of microprocessor programming these days and with the compiler I use you don't have to do integer division and mod. Both values are available after just an integer division.


RE: Prime pattern 6 +/- 1 - triggered - 07-07-2022

you guys should mash your heads together and write us a maths book!