Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
One liner recursive prime generator
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { IEnumerable<int> primes = null; primes = Enumerable.Range(0,int.MaxValue).Where(x=>x==2||(x>2&&primes.TakeWhile(p=>p<=Math.Sqrt(x)).All(p=>x%p!=0))); primes.TakeWhile(x=>x<=1000).ToList().ForEach(Console.WriteLine); } } }
run
|
edit
|
history
|
help
1
ShakerSort
String to Decimal CSHARP
Generic operator test
Prsonal informashin
Types
asdxasxasdf
Main 5.4
ObjectPool
MockTest
ASCII table generator