Bernoulli numbers: Difference between revisions

m
→‎Using Math.NET: corrected range that fell short by one, removed warning, added last element to output.
m (added whitespace and highlighting to the task's preamble.)
m (→‎Using Math.NET: corrected range that fell short by one, removed warning, added last element to output.)
Line 412:
 
=== Using Math.NET ===
 
{{incomplete|C#| <br> (using Math.Net} <br> <br> The &nbsp; '''B'''<sub>60</sub> &nbsp; Bernoulli number isn't displayed in the output. <br> <br> }}
 
{{libheader|MathNet.Numerics}}
Line 459 ⟶ 457:
static void Main()
{
Enumerable.Range(0, 6061) // the second parameter is the number of range elements, and is not the final item of the range.
.Select(n => new {N = n, BernoulliNumber = CalculateBernoulli(n)})
.Where(b => !b.BernoulliNumber.Numerator.IsZero)
Line 502 ⟶ 500:
B(56) = -2479392929313226753685415739663229 / 870
B(58) = 84483613348880041862046775994036021 / 354
B(60) = -1215233140483755572040304994079820246041491 / 56786730
</pre>