mersenneforum.org "My Prime Verify Code"
 Register FAQ Search Today's Posts Mark Forums Read

2020-11-17, 23:14   #45
Uncwilly
6809 > 6502

"""""""""""""""""""
Aug 2003
101×103 Posts

9,209 Posts

Quote:
 Originally Posted by Uncwilly My VBA code running in Excel beat the speed of this code by a large margin. If I can find it (not before Tuesday evening UTC), I will benchmark it and post the results. Let's see how much faster it is checking numbers. I bet my code could factor numbers as fast as this could can determine it a number was prime.
Quote:
 Originally Posted by ONeil Thats fast I'd like to see Uncwilly
Quote:
 Originally Posted by retina Now have at it, and beat Uncwilly. And of course, all of this is completely useless. There are programs out there that a many orders of magnitude faster than this silly Python code. But whatever.
Found the file on a thumbdrive and added timing to parts of it.

Your code took 3 seconds to check 1105 to see if it is prime.
I asked Wolfram Alpha for a random prime in the highest range that Excel can natively handle. It gave me: 162254563
My little "PrimeToolKit" excel can check for prime, factor, or yield primes in a given range.
It took 3 seconds to generate 1144 primes from 162254563 to 162277063 (that includes display overheads, such as clearing ~10000 cells).
I asked WA for 2 primes from 9000 to 10000. I calculated the product and then fed that into my code. The factoring happened so quickly as to appear instantaneous and was less than the time resolution of excel.

My code is not the best by far. But it works nice for small numbers.

 2020-11-17, 23:48 #46 Xyzzy     "Mike" Aug 2002 5×7×227 Posts Did you forget to attach it?
2020-11-18, 00:07   #47
Uncwilly
6809 > 6502

"""""""""""""""""""
Aug 2003
101×103 Posts

9,209 Posts

Quote:
 Originally Posted by Xyzzy Did you forget to attach it?
No. I need to fix up a few items related to timing and remove other items (a sheet that turns colors based on primes and an older factoring bit.) Again I will work on it later.

2020-11-18, 02:46   #48
Dr Sardonicus

Feb 2017
Nowhere

105316 Posts

Quote:
Originally Posted by Uncwilly
Quote:
 Originally Posted by ONeil Thats fast I'd like to see Uncwilly
Your code took 3 seconds to check 1105 to see if it is prime.

This is one case where man really can beat machine. The final decimal digit is 5 in a number greater than 5. Not prime. Done. two, three.

2020-11-18, 23:15   #49
Uncwilly
6809 > 6502

"""""""""""""""""""
Aug 2003
101×103 Posts

9,209 Posts

Quote:
 Originally Posted by Xyzzy Did you forget to attach it?
Quote:
 Originally Posted by Uncwilly No. I need to fix up a few items related to timing and remove other items (a sheet that turns colors based on primes and an older factoring bit.) Again I will work on it later.
Ok, I did not change the factoring code itself. I added timing to all 3 functions. I found out how to get timing in milliseconds and put the start time right after the dim for the variable and the end time in the very list bit after everything else is displayed (this is to give the largest possible time for my code.)
The Excel file with the VBA is in the zip.
Attached Files
 Prime Toolkit.zip (116.5 KB, 12 views)

 Similar Threads Thread Thread Starter Forum Replies Last Post marsik84 Miscellaneous Math 6 2020-04-30 20:27 pinhodecarlos Prime Gap Searches 170 2019-12-10 19:33 ssybesma Information & Answers 9 2018-12-13 13:42 Godzilla Miscellaneous Math 25 2018-09-28 17:10 MercPrime Information & Answers 5 2013-05-12 22:03

All times are UTC. The time now is 10:12.

Sun Jan 24 10:12:54 UTC 2021 up 52 days, 6:24, 0 users, load averages: 1.96, 1.93, 1.96