Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculating Anti-Primes
#4
(07-06-2023, 07:16 PM)bplus Wrote: I don't know, can you find a formula? but your thing looks pretty fast! Have you looked at Rosetta Code this looks like a classic task for them.

Welcome to the forum!

Yes RC has it: https://rosettacode.org/wiki/Anti-primes#FreeBASIC
FreeBasic is usually a good one to compare with.
Yeah, this is actually a slightly modified version of the QBasic Rosetta Code post (I noted that at the top of the code block).  The formula is straightforward for a procedural type approach.

My main question (I should have been more clear) is: can I do anything else QB64 to tweak our some more speed.  If you take the number of anti-primes from 45 to 50 it gets closer to 27 seconds and just rockets up from there.

I changed everything I could to INTEGER types (the fastest for QB64 I believe), and only used the LONG type when needed.  This made a somewhat amazing/surprising increase in speed.

Short of a functional or vectorized approach, I am just looking if I am missing something obvious for speed....assuming no formula change.

Thanks again, and this was my first post and first reply on the forum!

Smile
Reply


Messages In This Thread
Calculating Anti-Primes - by Space_Ghost - 07-06-2023, 06:56 PM
RE: Calculating Anti-Primes - by bplus - 07-06-2023, 07:16 PM
RE: Calculating Anti-Primes - by Space_Ghost - 07-06-2023, 08:00 PM
RE: Calculating Anti-Primes - by mnrvovrfc - 07-06-2023, 07:54 PM
RE: Calculating Anti-Primes - by Space_Ghost - 07-06-2023, 08:11 PM
RE: Calculating Anti-Primes - by bplus - 07-06-2023, 11:38 PM
RE: Calculating Anti-Primes - by Space_Ghost - 07-06-2023, 11:43 PM
RE: Calculating Anti-Primes - by Jack - 07-07-2023, 11:50 AM
RE: Calculating Anti-Primes - by Space_Ghost - 07-07-2023, 04:38 PM
RE: Calculating Anti-Primes - by Stuart - 07-07-2023, 08:15 PM
RE: Calculating Anti-Primes - by Space_Ghost - 07-07-2023, 10:12 PM
RE: Calculating Anti-Primes - by david_uwi - 07-08-2023, 04:10 PM
RE: Calculating Anti-Primes - by Jack - 07-08-2023, 04:39 PM
RE: Calculating Anti-Primes - by Kernelpanic - 08-13-2023, 12:23 AM
RE: Calculating Anti-Primes - by david_uwi - 07-08-2023, 05:45 PM
RE: Calculating Anti-Primes - by Jack - 07-08-2023, 05:59 PM
RE: Calculating Anti-Primes - by Space_Ghost - 07-08-2023, 07:02 PM
RE: Calculating Anti-Primes - by Jack - 07-08-2023, 07:14 PM



Users browsing this thread: 1 Guest(s)