diff --git a/src/DotNext/Numerics/Number.cs b/src/DotNext/Numerics/Number.cs
index 830e2c419..e17f345b0 100644
--- a/src/DotNext/Numerics/Number.cs
+++ b/src/DotNext/Numerics/Number.cs
@@ -177,12 +177,12 @@ static T Sqrt(T value)
/// Gets a prime number which is greater than the specified value.
///
/// The type of the value.
- /// The table with cached prime numbers sorted in ascending order.
/// The value which is smaller than the requested prime number.
+ /// The table with cached prime numbers sorted in ascending order.
/// The prime number which is greater than .
/// There is no prime number that is greater than and less than .
[EditorBrowsable(EditorBrowsableState.Never)]
- public static T GetPrime(ReadOnlySpan cachedPrimes, T lowerBound)
+ public static T GetPrime(T lowerBound, ReadOnlySpan cachedPrimes = default)
where T : struct, IBinaryInteger, ISignedNumber, IMinMaxValue
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(lowerBound);
diff --git a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/LeaderState.Context.cs b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/LeaderState.Context.cs
index 8a29cb69b..bdd60d337 100644
--- a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/LeaderState.Context.cs
+++ b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/LeaderState.Context.cs
@@ -84,7 +84,7 @@ public Context(int sizeHint)
{
Debug.Assert(sizeHint > 0);
- entries = new ContextEntry?[GetPrime(Primes, sizeHint)];
+ entries = new ContextEntry?[GetPrime(sizeHint, Primes)];
}
private static int Grow(int size)
@@ -97,7 +97,7 @@ private static int Grow(int size)
? throw new InsufficientMemoryException()
: (uint)(newSize = size << 1) > maxPrimeLength && maxPrimeLength > size
? maxPrimeLength
- : GetPrime(Primes, newSize);
+ : GetPrime(newSize, Primes);
}
public Context() => entries = [];