10-20-2005 01:51 PM
10-20-2005 01:56 PM
I still want to see some submissions with prime number generators and trial division. One of my categories will probably be the most efficient prime number generator up to 100000000, even if that is not the winning technique. Even if you move on to a new technique, send me your best prime number generator.
Thanks,
Bruce
10-20-2005 02:11 PM
10-21-2005 12:11 PM - edited 10-21-2005 12:11 PM
Bsquared,
Don't uderestimate the power of LabVIEW for problems like that, it can be competitive with C. (also have a look at this article).
(Besides, even if LabVIEW were slower, it's still a very interesting challeng. NASCAR did not make the Tour de France obsolete ;))
I've implemented a fake LabVIEW factorizer subVI that simply calls a publicly available W32 program (presumably written in C), then parses the output back. It is slower than fahlers (Of course there might be some extra calling overhead).
See attached image of 8 runs (Note that the y axis is linear instead of lograrithmic!).

Also don't forget that LabVIEW gets improves over time. All my entries are about 20% faster under LabVIEW 8.0 compared to LabVIEW 7.1. 😄
Message Edited by altenbach on 10-21-2005 10:44 AM
10-21-2005 01:51 PM
Bruce,
@Bruce Ammons wrote:
.
.
.
180 msec is quite impressive!!! I figured there was a faster way to do it than generating a list of prime numbers and using trial division, but that was all that I had seen so far. Do you want to send me your version for an official time?I suspect now folks will start looking at alternative methods for factoring to try to catch up with you.Bruce
10-21-2005 02:25 PM
10-21-2005 03:00 PM
10-21-2005 03:15 PM - edited 10-21-2005 03:15 PM
fahlers wrote:
Also the algorithm I employed will fail to factorize a number N of the form N=m² + 1. (Maybe you know by now which algorithm I used).
-Franz
ha ha!
yes, i think i do. trying this algorithm for a certain number of cycles, then switching to a probablistic algorithm for another limited set of cycles would be a good compromise between speed and guarenteeing that the program would finish before the next ice age, with N having any combination of large factors. finding the optimum number of iterations to run each algorithm would be the challenge.
i am still trying to get the purely probablistic algorithm approach faster at this point...
regards,
- ben.
Message Edited by bsquared on 10-21-2005 03:23 PM
10-23-2005 06:24 PM
I fnally got around to doing a sieve version and now can generate all of my primes fast enough to concider doing the factoring part.
Still alive,
Ben
10-24-2005 08:00 PM
Okay, Franz sent me his latest submission. It came in at a speedy 139 msec, and all the answers are right. Franz has told me he is working on a more robust version that can handle all the possibilities, which will probably end up a little bit slower. It did bring up the need for a couple of rule clarifications, though.
Even if you don't use all the prime numbers up to 100000000, you do need to generate the majority of your prime numbers from scratch. For example, even if you only use the first 1000 prime numbers, you need to generate most of them (900 or so) using some sort of algorithm. A table of prime numbers is only allowed when it is the starting point for generating a larger list. If this still isn't clear, please ask questions. I realize that this is kind of a moot point, since you can probably generate the primes up to 10000 or so in less than 1 msec, but I want everybody to have the same rules.
I will also request that everybody use the "first call?" primitive (found under synchronization) to initialize their vi. After you press the run button, the first time the vi is called it will return true. The rest of the time it will return false. When you press the run button again, it resets to true again. This will eliminate my need to close your vi and reopen it every time I run it.
I found the only way I could get consistent times was to use the "run continuously" button. Each time the test vi ran using this method the time was within a couple of msec. When I run it using the run button, I had times between 139 msec and 300+ msec.
I will probably modify the test vi and take out the indicators for the final test. If I am looking for millisecond differences, I don't want to waste any time updating displays.
So now the bar has definitely been raised much higher. How much faster can we go? hmmm...
Bruce