LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Project Euler Problems Help (Urgent)

Thanks 

0 Kudos
Message 11 of 35
(1,122 Views)

Get the definition of e here:Euler's number to 10,000 digits


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 12 of 35
(1,119 Views)

Or you can use a Taylor Series.  More specifically, the Maclaurin series for e^x is SUM( x^n / n! ) for n=1 to infinity.

 

so for e, use e^1 and that'd be

SUM( 1^n / n! )

which is:

1 + 1 + 1/2 + 1/6 + 1/24 + ...

 

You'll have to do most of the addition in strings because you'll be calculating out to 1000 digits and the double precision format can only hold about 15 digits past the decimal.

 

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 13 of 35
(1,109 Views)

I have now done all questions except question 1. Even after getting info from community members and trying for the past 4 hours, I am unable to do it. Please understand that this problem is too difficult for me to do, so I am giving up. If anyone has the solution vi, please kindly provide. 

 

I have already posted the VIs that I could do which shows that I tried on my own before asking here. I think it is better now to look into a working solution and understand the code than to give up.

0 Kudos
Message 14 of 35
(1,076 Views)

It's a fair bit of effort to code this, so I doubt anyone is going to hand you the solution unless they are REALLY interested in the problem.

 

Let's simplify it- forget the part about the sum of the digits, the harder part is calculating e to a high numbrt of digits so let's focus on that. James has already nailed the method- you need to write your own routines to do the math. You need to implement add, multiply and divide functions that can work on numbers represented as strings in order to do the calculations for the taylor series he mentioned.

 

Build it up. Start with an add function- think about how you add two numbers, digit by digit and carrying the overflows, and come up with an algorithm that copies it. You'll need a loop to iterate over the digits and a shift register to pass the carries. Just have a crack at the add function. If you can do that much, you're well on the way to cracking the whole thing.

0 Kudos
Message 15 of 35
(1,062 Views)

Here's a link to an example that multiplies 2 integers the way ToeCutter mentioned.  It might work as a starting point.

 

Just for reference, which Euler Problem is this?

 

https://decibel.ni.com/content/docs/DOC-34858

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 16 of 35
(1,058 Views)

Question 1 is not found in Project euler site. I got it from other sites that do codes using java, c++, python etc. I was trying to code them in LabVIEW. Thankyou very much for the link James. Ok I will try again.

0 Kudos
Message 17 of 35
(1,046 Views)

I think there was a coding challenge several years ago which addressed the large numbers of digits arithmetic issue. A search may find some useful code or ideas.

 

Lynn

0 Kudos
Message 18 of 35
(1,037 Views)

I have done question 1 and got the result as 2147483647. Is this correct ?

0 Kudos
Message 19 of 35
(1,022 Views)

Please can anyone check wether the final result for question 1 is 2147483647 or not?

 

Thanks

0 Kudos
Message 20 of 35
(1,013 Views)