Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,18 @@
import std.stdio, std.range, std.algorithm, std.conv, arithmetic_rational;
auto bernoulli(in uint n) pure nothrow /*@safe*/ {
auto A = new Rational[n + 1];
foreach (immutable m; 0 .. n + 1) {
A[m] = Rational(1, m + 1);
foreach_reverse (immutable j; 1 .. m + 1)
A[j - 1] = j * (A[j - 1] - A[j]);
}
return A[0];
}
void main() {
immutable berns = 61.iota.map!bernoulli.enumerate.filter!(t => t[1]).array;
immutable width = berns.map!(b => b[1].numerator.text.length).reduce!max;
foreach (immutable b; berns)
writefln("B(%2d) = %*d/%d", b[0], width, b[1].tupleof);
}