TekPub Linq Challenge!

by Chris Nicola 8. January 2010 16:51
  1. var primes = Enumerable.Range(1, n)
  2.     .Where(x => (x > 1 && x < 4) ||
  3.         !Enumerable.Range(2, x/2 - 1).Any(p => x % p == 0));

http://www.codethinked.com/post/2010/01/08/TekPubs-Mastering-LINQ-Challenge.aspx

http://www.tekpub.com/

Edit: This is definitely a pretty lazy solution I will admit ;P

Tags:

Comments

1/8/2010 11:38:57 AM #

trackback

Winners of the TekPub LINQ Challenge

Winners of the TekPub LINQ Challenge

CodeThinked | Reply

Add comment


(Displays Gravatar)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Welcome

My name is Chris Nicola and I am software developer/engineer in Vancouver, Canada.  

I am primarily a .NET'er but my interests range far and wide.  My currently interes include domain driven design, test driven design, command-query responsibility segregation, and agile software development practices.  

I am also an active member of ALT.NET and Agile Vancouver.

Vancouver ALT.NET

Recent Comments

Comment RSS

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar