Vasu Balakrishnan’s Blog

Project Euler #29

leave a comment »

 
 
Answer: 9183
 
Solution:  As I mentioned in my other post, I use my little helper GenerateNumbers method to get my sequence. Also I couldn’t use the built-in C# data types. So I used F# BigInt.
 
var lOutput =   from lB in FunExtensions.GenerateNumbers(2, 100, pInt => pInt)
                from lA in FunExtensions.GenerateNumbers(2, 100, pArg => 
                                                            BigInt.Pow(new BigInt(pArg), new BigInt(lB)))
                orderby lA
                select lA;
return lOutput.Distinct().Count();
 
Time: 121 ms
 
 
Advertisements

Written by nbvasu

May 15, 2009 at 12:05 am

Posted in C#, Euler, General

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: