OEIS A276225 - Implementation in D
a(n+3) = 2*a(n+2) + a(n+1) + a(n) with a(0)=3, a(1)=2, a(2)=6.
Recurrence with function in string form...
import std.stdio;
import std.range;
void main() {
"\nOEIS - A276225\n".writeln;
auto a276225Rec(uint n) => recurrence!("2*a[n-1] + a[n-2] + a[n-3]")(3uL, 2uL, 6uL).take(n+1);
writefln("%3s %14s", "n", "a(n)");
foreach(index, sequence; enumerate(a276225Rec(32)))
{
writefln("%3d %14d", index, sequence);
}
writeln;
a276225Rec(32).writeln;
}
OEIS - A276225
n a(n)
0 3
1 2
2 6
3 17
4 42
5 107
6 273
7 695
8 1770
9 4508
10 11481
11 29240
12 74469
13 189659
14 483027
15 1230182
16 3133050
17 7979309
18 20321850
19 51756059
20 131813277
21 335704463
22 854978262
23 2177474264
24 5545631253
25 14123715032
26 35970535581
27 91610417447
28 233315085507
29 594211124042
30 1513347751038
31 3854221711625
32 9816002298330
[3, 2, 6, 17, 42, 107, 273, 695, 1770, 4508, 11481, 29240, 74469, 189659, 483027, 1230182, 3133050, 7979309, 20321850, 51756059, 131813277, 335704463, 854978262, 2177474264, 5545631253, 14123715032, 35970535581, 91610417447, 233315085507, 594211124042, 1513347751038, 3854221711625, 9816002298330]