Showing results for 
Search instead for 
Did you mean: 

labview challenge

Hi Franz,

about the "old" challenge VIs, where are they available? I've looked for them, but I haven't been able to find any since the forum moved. I can't find them on the official "coding challenge" page, and the old forum discussions I can't find.....

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 31 of 48
I have attached my code for the factorial challenge for those that are interested.

When I went back and looked at the code, it looked overly complex. I think several things could have been simplified without affecting the time much. However, it does provide a start for the bigint manipulation.

Bruce Ammons
Ammons Engineering
Message 32 of 48
I am curious...

10000 digits.. You mean that you will pass it a number whose string lenth is 10,000??? As in a huge number??

Or do you mean the input number is 10 000 max. ?

> > lost in translation < <

Message 33 of 48
10000 digits, as in huge number. That is what makes it a challenge!!!

Bruce Ammons
Ammons Engineering
Message 34 of 48

Bruce submitted already his solution from the previous challenge, but anyway, here is the link to past challenges:

Regarding the algorithms, I also use a Newton-Raphson iteration for the root finding. I did not come up with bigint division algorithm, but use another Newton-Raphson to calculate the inverse of a bigint.

The bigint multiplication Bruce (and some others including me) used in the factorial challenge employs a fast Fourier transform. For me it was surprising to learn at that time that an FFT would help with a bigint multiply. It is not that surprising, though, since if you look at it, the multiplication of two long decimal numbers with the naive school-arithmetic approach is formally equivalent to a convolution. The FFT based bigint multiply is known as the Strassen-Schönhage algorithm, AFAIK.

0 Kudos
Message 35 of 48
That explains why it is a character string...

And I would drop the lookup table idea..

Interesting challenge, though... (DoH!)

Message 36 of 48

@Bruce Ammons wrote:
I am using the Newton-Raphson method to find the root.

Interesting. In my casual testing, Newton-Raphson is a bit problematic with pure integer math. Are you doing anything special?

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 37 of 48
The only difficulty is the division, and I check the remainder and round up or down accordingly. Since we know the solution is going to be an integer, I know rounding is okay. I calculate a couple of digits past the decimal just to be safe, though.

I'm not really doing pure integer math, either. My bigint representation still uses DBLs to represent each piece of the integer.

Bruce Ammons
Ammons Engineering
Message 38 of 48
Okay, we are getting close to the deadline. There are about 3 weeks left. I just submitted my entry.

My final time is about 18 msec to calculate the square root of a 10000 digit number. This is the slowest root to calculate. My average time for randomly generated numbers is about 3.5 msec.

Anybody else getting good times?

Bruce Ammons
Ammons Engineering
0 Kudos
Message 39 of 48
Unfortunately, I haven't had time to work on this challenge, so my best time is +Inf.

18 ms sounds like a pretty good result. Having not taken part in the Vampire number challenge either, I don't think I'd get anywhere close to this in the next 3 months or so......

Looking forward to the results

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 40 of 48