Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prime pattern 6 +/- 1
#11
@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.
b = b + ...
Reply
#12
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.
Reply
#13
you guys should mash your heads together and write us a maths book!
Reply




Users browsing this thread: 2 Guest(s)