Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

OEIS A000108 - Implementation in D

Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!).

Source code

Sequence with function in string form...

import std.stdio;
import std.range;


enum strFrmFunc = "a[n-1] * (4*n-2) / (n+1)";
auto a000108Rec = recurrence!(strFrmFunc)(1uL);

void main()
{
    a000108Rec.take(31).writeln;
}

Output

[1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, 6564120420, 24466267020, 91482563640, 343059613650, 1289904147324, 4861946401452, 18367353072152, 69533550916004, 263747951750360, 1002242216651368, 3814986502092304]