Skip to content

Instantly share code, notes, and snippets.

@Mikescher
Created September 10, 2014 13:48
Show Gist options
  • Save Mikescher/43dd385c6213888fd452 to your computer and use it in GitHub Desktop.
Save Mikescher/43dd385c6213888fd452 to your computer and use it in GitHub Desktop.
LINQ - Primes
Enumerable.Range(2, 1000)
.Where(p =>
!Enumerable.Range(2, p/2 + 1)
.Any(q => p%q == 0 && p-q != 0)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment