Interface Sequence<T>
- All Known Subinterfaces:
ConvergentSequence<T>, IntegerSequence
- All Known Implementing Classes:
BellSequence, CatalanSequence, FactorialSequence, FibonacciSequence, PrimePiSequence, PrimeSequence, RecursiveSequence, SquareSequence, TriangularSequence
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 Summary
Modifier and TypeMethodDescriptiondefault TFunction interface implementation - delegates to get(Natural).default TFunction interface implementation - delegates to get(Natural).default Tget(int n) Convenience method for primitive int indices.Returns the n-th term of the sequence (0-indexed).default StringReturns the domain description.default StringReturns a formula or description of how terms are computed.default StringgetName()Returns a human-readable name for this sequence.default StringReturns the OEIS (Online Encyclopedia of Integer Sequences) identifier.Methods inherited from interface Function
andThen, compose, contains, evaluate, getBackend, isContinuous, isDifferentiable, setBackendMethods inherited from interface Relation
getCodomain
-
Method Details
-
get
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
-
get
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
-
getDomain
-
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
-
getFormula
Returns a formula or description of how terms are computed.- Returns:
- mathematical formula or description
-