Interface Sequence<T>

All Superinterfaces:
Function<Natural,T>, Function<Natural,T>, Relation<Natural,T>
All Known Subinterfaces:
ConvergentSequence<T>, IntegerSequence
All Known Implementing Classes:
BellSequence, CatalanSequence, FactorialSequence, FibonacciSequence, PrimePiSequence, PrimeSequence, RecursiveSequence, SquareSequence, TriangularSequence

public interface Sequence<T> extends Function<Natural,T>
A mathematical sequence a(n) for n ≥ 0.

A sequence is a function from natural numbers to type T: ℕ → T. Compatible with OEIS (Online Encyclopedia of Integer Sequences) format.

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

    • get

      T get(Natural n)
      Returns the n-th term of the sequence (0-indexed).

      This is the canonical method using Episteme number types.

      Parameters:
      n - the index (n ≥ 0)
      Returns:
      a(n)
      Throws:
      IllegalArgumentException - if n is negative
    • evaluate

      default T evaluate(Natural n)
      Function interface implementation - delegates to get(Natural).
      Specified by:
      evaluate in interface Function<Natural,T>
      Parameters:
      n - the index
      Returns:
      a(n)
    • get

      default T get(int n)
      Convenience method for primitive int indices.

      Delegates to get(Natural) after converting to Natural.

      Parameters:
      n - the index (must be ≥ 0)
      Returns:
      a(n)
      Throws:
      IllegalArgumentException - if n invalid input: '<' 0
    • apply

      default T apply(Natural n)
      Function interface implementation - delegates to get(Natural).
      Specified by:
      apply in interface Function<Natural,T>
      Specified by:
      apply in interface Function<Natural,T>
      Parameters:
      n - the index
      Returns:
      a(n)
    • getDomain

      default String getDomain()
      Description copied from interface: Relation
      Returns the domain description.
      Specified by:
      getDomain in interface Relation<Natural,T>
      Returns:
      domain name (e.g., "ℝ", "ℕ", "ℂ")
    • getOEISId

      default String getOEISId()
      Returns the OEIS (Online Encyclopedia of Integer Sequences) identifier. For example, "A000045" for Fibonacci numbers.
      Returns:
      OEIS ID or null if not catalogued
    • getName

      default String getName()
      Returns a human-readable name for this sequence.
      Returns:
      sequence name
    • getFormula

      default String getFormula()
      Returns a formula or description of how terms are computed.
      Returns:
      mathematical formula or description