LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate the 100.000st prime number as fast as possible

Hello,

 

We were doing some experiments trying to calculate the 100.000st prime number in labview as fast as possible.

Some of us got to about 7 seconds. Does anyone know a way to calculate it faster using labview?

 

 

Kev

0 Kudos
Message 1 of 6
(4,594 Views)
Check out this thread Prime Factor Coding Challenge.
0 Kudos
Message 2 of 6
(4,577 Views)

Hi Pluven,

 

"Does anyone know a way to calculate it faster using labview?"

 

Yes, me. Smiley Wink

~30ms (mostly for initialization) on a 4 year old Core2Duo T5500... Hint: you need to calc to roughly 1.4e7.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(4,561 Views)

thanks for the replys. Any chance we could see a VI of this?

 

Grtz

Pluv

0 Kudos
Message 4 of 6
(4,552 Views)

Hi Pluv,

 

the VI is mainly based on those Coding challenge linked by Raven's Fan...

 

And as this sounds like homework (or similar) I would suggest to read that old thread, read articles on Wikipedia, and then do some own coding instead of adorning with borrowed plumes... To calc primes is described in numerous places in the internet, all you need is reading and coding!

 

And here's you can look at my VI:

GeneratePrimes.png 

 

One correction to my first post: you only need to calc upto 1.3e6... The 100.000th prime is 1299709.

Prime_FP.PNG

Message Edited by GerdW on 05-15-2010 01:36 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(4,544 Views)

Hi GerdW,

 

This actually wasn't homework, it was a challenge from a teacher after our final lessons. This might be usefull for exams but it's not an assignment.

I allready saw a couple using the same technique over & over. The old record was 17s yet we managed to improve that in a couple of hours.

So i was wondering if we could do it in a couple of hours, then experts should be able to do it alot faster ( as u said 30ms).

 

The reason i want to see VI's is to understand labview better. Seeing these things one way is fine, but it's when u start comparing different ways to the same problem that u rlly start learning 🙂

 

 

So thanks for the replys!

 

Grtz

Message Edited by Pluven on 05-15-2010 06:38 AM
Message Edited by Pluven on 05-15-2010 06:40 AM
0 Kudos
Message 6 of 6
(4,533 Views)