Initial commit.
This commit is contained in:
1 parent
e5b0fea18c
commit
9f35f6c558
94 files changed
+12857
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using PeterO.Numbers;
|
||||
|
||||
namespace PerfectNumbers.Core;
|
||||
|
||||
public static class AlphaCalculations
|
||||
{
|
||||
public static ERational ComputeAlphaP(EInteger p, int k)
|
||||
{
|
||||
int exponent = checked(4 * k + 1);
|
||||
EInteger y = PowerCache.Get(p, exponent);
|
||||
return ERational.Create(y * p - 1, y * (p - 1));
|
||||
}
|
||||
|
||||
public static ERational ComputeAlphaFactor(EInteger q, int a2)
|
||||
{
|
||||
EInteger num = PowerCache.Get(q, a2 + 1) - EInteger.One;
|
||||
EInteger den = PowerCache.Get(q, a2) * (q - EInteger.One);
|
||||
return ERational.Create(num, den);
|
||||
}
|
||||
|
||||
public static ERational ComputeAlphaM(ReadOnlySpan<EInteger> primes, int maxR, int a2)
|
||||
{
|
||||
ERational result = ERational.One;
|
||||
for (int i = 0; i < maxR; i++)
|
||||
result = result.Multiply(ComputeAlphaFactor(primes[i], a2));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user