Skip to content

Commit 2ce2d59

Browse files
committed
Comb::catalan()
1 parent 1ddc205 commit 2ce2d59

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/alfred/math/comb.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ class Comb {
4545
if (n < m || m < 0) return 0;
4646
return fac(n) * invfac(n - m);
4747
}
48+
inline mint catalan(int n) {
49+
return binom(2 * n, n) - binom(2 * n, n - 1);
50+
}
4851
};
4952

5053
#endif // AFMT_COMB

0 commit comments

Comments
 (0)