Class PrimeSequence
java.lang.Object
org.episteme.core.mathematics.analysis.series.PrimeSequence
- All Implemented Interfaces:
Function<Natural,Integer>, Function<Natural, Integer>, Relation<Natural, Integer>, IntegerSequence, Sequence<Integer>
Prime number sequence: 2, 3, 5, 7, 11, ...
Uses a segmented sieve for efficient generation of large primes. Supports GPU acceleration for batch generation if a compatible backend is provided.
*
Reference:
Prim, R. C. (1957). Shortest connection networks and some generalizations. Bell System Technical Journal, 36(6), 1389-1401.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget(int n) Convenience method using primitive int.Returns the n-th term of the sequence (0-indexed).Returns the currently set compute backend.Returns a formula or description of how terms are computed.getName()Returns a human-readable name for this sequence.Returns the OEIS (Online Encyclopedia of Integer Sequences) identifier.voidsetBackend(ComputeBackend backend) Sets the compute backend for this function (e.g., enable GPU).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Function
andThen, compose, contains, evaluate, isContinuous, isDifferentiableMethods inherited from interface IntegerSequence
getLong, getLongMethods inherited from interface Relation
getCodomain
-
Constructor Details
-
PrimeSequence
public PrimeSequence()
-
-
Method Details
-
get
-
get
-
setBackend
Description copied from interface:FunctionSets the compute backend for this function (e.g., enable GPU).- Specified by:
setBackendin interfaceFunction<Natural,Integer> - Parameters:
backend- the compute backend
-
getBackend
Description copied from interface:FunctionReturns the currently set compute backend.- Specified by:
getBackendin interfaceFunction<Natural,Integer> - Returns:
- the compute backend, or null if none is explicitly set or supported.
-
getOEISId
-
getName
-
getFormula
Description copied from interface:SequenceReturns a formula or description of how terms are computed.- Specified by:
getFormulain interfaceSequence<Integer>- Returns:
- mathematical formula or description
-