Strange unique prime triplets: Difference between revisions

m
→‎{{header|C#|CSharp}}: added note about sieve time
(Added C# version)
m (→‎{{header|C#|CSharp}}: added note about sieve time)
Line 202:
 
=={{header|C#|CSharp}}==
Just for fun, <30 sorted by sum, instead of order generated. One might think one should include the sieve generation time, but it is orders of magnitude smaller than the permute/sum time for these relatively low numbers.
<lang csharp>using System; using System.Collections.Generic; using static System.Console; using System.Linq; using DT = System.DateTime;
 
Line 215:
for (int c = b + 1; c <= i; c++) {
if (PG.flags[d = prab + pr[c]]) continue; f++;
if (lmt < 100) r.Add(string.Format("{3,5} = {0,2} + {1,2} + {2,2}", pra, pr[b], pr[c], d)); } } } s = "s.u.p.t.s under ";
s = "s.u.p.t.s under "; r.Sort(); if (r.Count > 0) WriteLine("{0}{1}:\n{2}", s, m, string.Join("\n", r));
if (lmt > 100) WriteLine("Count of {0}{1,6:n0}: {2,13:n0} {3} sec", s, m, f, (DT.Now - st).ToString().Substring(6)); } } }