Class CatalanSequence

java.lang.Object
org.episteme.core.mathematics.analysis.series.CatalanSequence
All Implemented Interfaces:
Function<Natural,Integer>, Function<Natural,Integer>, Relation<Natural,Integer>, IntegerSequence, Sequence<Integer>

public class CatalanSequence extends Object implements IntegerSequence
Catalan numbers: C(0)=1, C(n) = (2n)! / ((n+1)! * n!).

OEIS A000108: Catalan numbers.

Counts the number of:

  • Binary trees with n internal nodes
  • Ways to triangulate a convex (n+2)-gon
  • Balanced parentheses sequences of length 2n

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • CatalanSequence

      public CatalanSequence()
  • Method Details

    • get

      public Integer get(Natural n)
      Description copied from interface: Sequence
      Returns the n-th term of the sequence (0-indexed).

      This is the canonical method using Episteme number types.

      Specified by:
      get in interface Sequence<Integer>
      Parameters:
      n - the index (n ≥ 0)
      Returns:
      a(n)
    • getOEISId

      public String getOEISId()
      Description copied from interface: Sequence
      Returns the OEIS (Online Encyclopedia of Integer Sequences) identifier. For example, "A000045" for Fibonacci numbers.
      Specified by:
      getOEISId in interface Sequence<Integer>
      Returns:
      OEIS ID or null if not catalogued
    • getName

      public String getName()
      Description copied from interface: Sequence
      Returns a human-readable name for this sequence.
      Specified by:
      getName in interface Sequence<Integer>
      Returns:
      sequence name
    • getFormula

      public String getFormula()
      Description copied from interface: Sequence
      Returns a formula or description of how terms are computed.
      Specified by:
      getFormula in interface Sequence<Integer>
      Returns:
      mathematical formula or description
    • getCodomain

      public String getCodomain()
      Description copied from interface: Relation
      Returns the codomain description.
      Specified by:
      getCodomain in interface Relation<Natural,Integer>
      Returns:
      codomain name