Euler 7 Trivial with LINQ and Generators
Euler problem 7 requires returning the 10001st prime number. It notes that the 6th prime number is 13 in the problem description. Having already done some work with iterators and various number generators, including a Primes generator for previous Euler problems, the base case given in the problem can be reduced to this NUnit test:
public void SixthPrimeIs13()
{
Assert.AreEqual(13, NumberGenerator.Primes().Take(6).Last());
}
Replacing the 6 with 10001 takes care of the rest. Iām really starting to dig using LINQ for this stuff.




Comments
UGG Boots sale said on 28 Jan 2010 at 2:24 AM
including a Primes generator for previous Euler problems, the base case given in the problem can be reduced to this NUnit test:
Snoring Treatment said on 02 Feb 2010 at 1:52 AM
I have been using a Func pad for the last 6 years. Nothing comes close. I use the ArchType model with the aluminum bevel and found that to be the best (it helps to hold it's shape better). Love 'em.