Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
prime number experiment
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Accurate up to the 39th prime number //i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0 && i%11!=0 && i != 1 double prime = 0; double count = 6; double iterations = 42; double i = 0; double j = 0; double product = 1; //count = count-6; for (i=1; i<=double.PositiveInfinity; i++) { if (count >= iterations){ Console.WriteLine($"Count has reached zero, Product is {prime}"); break;} if (i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0 && i%11!=0 && i != 1 && count>0) { prime = i; Console.WriteLine($"prime{count}, {prime}"); count+=1; } if (count == iterations){ Console.WriteLine($"Count is zero...breaking loop"); break;} } Console.WriteLine($"the final count is {count}"); } } }
run
|
edit
|
history
|
help
0
Reflection 2
see all nodes in given ldap node
Ortalama Hesaplayici
tokenExchange
Codenew
Range List for C#
fsdf
aaa
XPath
Recursion