Home Contact

X

Coder, not artist.

News

All code on here is free, but as a consequence it's up to you to check it, ha! If you have any questions, please use the contact button!

Twitter












Archives

Post Categories

Image Galleries

Syndication:

F#


Quick note RE: Euler problem 13

In the post about the solving of the Euler problem 13, I was using an older version of F#, to fix the code, replace the 'N' with an 'I'. So for example, the bigNums collection looks like this: let bigNums = [37107287533902102798797998... 463769376774900097126481248... ... 535035342264725242508740540... And the 'AddNums' method is now: let rec AddNums n = if n < 0 then 0I else AddNums (n-1) + bigNums.[n] No biggies... (Apologies ......

Euler Problem 13 - F#

I finally managed to solve a Euler problem in F# without first resorting to a C# version... That problem? 13... The problem is: "Work out the first ten digits of the sum of the following one-hundred 50-digit numbers." //Numbers all here... Usually, I go for the C# approach first, then see how I can work that into F#, but seeing as I didn't have any 'BigNum' types in C# (and I didn't consider the fact that I only needed to add the first 11 digits of each number - doh!) I dove straight into F#'s 'BigNum' ......