Descending primes: Difference between revisions
Content added Content deleted
(Added C# version) |
m (→{{header|C#|CSharp}}: typos) |
||
Line 172: | Line 172: | ||
class Program { |
class Program { |
||
static bool ispr(uint n) { |
|||
if ((n & 1) == 0 || n < 2) return n == 2; |
if ((n & 1) == 0 || n < 2) return n == 2; |
||
for (uint j = 3; j * j <= n; j += 2) |
for (uint j = 3; j * j <= n; j += 2) |
||
Line 193: | Line 193: | ||
else break; |
else break; |
||
} |
} |
||
Console.WriteLine("\n{0} |
Console.WriteLine("\n{0} descending primes found", c); |
||
} |
} |
||
}</lang> |
}</lang> |
||
Line 215: | Line 215: | ||
8764321 8765321 9754321 9875321 97654321 |
8764321 8765321 9754321 9875321 97654321 |
||
98764321 98765431 |
98764321 98765431 |
||
87 |
87 descending primes found</pre> |
||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |