mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > ONeil

Reply
 
Thread Tools
Old 2020-11-17, 23:14   #45
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

5·7·263 Posts
Default

Quote:
Originally Posted by Uncwilly View Post
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 View Post
Thats fast I'd like to see Uncwilly
Quote:
Originally Posted by retina View Post
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.
Uncwilly is offline   Reply With Quote
Old 2020-11-17, 23:48   #46
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

5×7×227 Posts
Default

Did you forget to attach it?

Xyzzy is offline   Reply With Quote
Old 2020-11-18, 00:07   #47
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

5·7·263 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
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.
Uncwilly is offline   Reply With Quote
Old 2020-11-18, 02:46   #48
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

2·2,089 Posts
Default

Quote:
Originally Posted by Uncwilly View Post
Quote:
Originally Posted by ONeil View Post
Thats fast I'd like to see Uncwilly
Your code took 3 seconds to check 1105 to see if it is prime.
I asked the OP about that, got no answer. Thanks for confirming.

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.
Dr Sardonicus is online now   Reply With Quote
Old 2020-11-18, 23:15   #49
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

5×7×263 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
Did you forget to attach it?
Quote:
Originally Posted by Uncwilly View Post
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
File Type: zip Prime Toolkit.zip (116.5 KB, 12 views)
Uncwilly is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prime numbers code broken marsik84 Miscellaneous Math 6 2020-04-30 20:27
Prime Gap Search latest version of the c code pinhodecarlos Prime Gap Searches 170 2019-12-10 19:33
picking a prime to VERIFY below M(57,885,161) ssybesma Information & Answers 9 2018-12-13 13:42
Verify the existence of a large enough prime number? Godzilla Miscellaneous Math 25 2018-09-28 17:10
Code for testing a prime other than form 2^n-1 MercPrime Information & Answers 5 2013-05-12 22:03

All times are UTC. The time now is 15:15.

Sat Jan 23 15:15:01 UTC 2021 up 51 days, 11:26, 0 users, load averages: 1.97, 1.98, 2.08

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.