MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / P

Function P

src/compute-engine/library/number-theory.ts:1023–1038  ·  view source on GitHub ↗
(n: bigint)

Source from the content-addressed store, hash-verified

1021 // MAX_VALUE_SCALED_ITERATIONS).
1022 if (steps > MAX_VALUE_SCALED_ITERATIONS)
1023 throw new CancellationError({
1024 message: `PrimitiveRoot: exceeded ${MAX_VALUE_SCALED_ITERATIONS} iterations`,
1025 cause: 'iteration-limit-exceeded',
1026 });
1027 }
1028 if (gcd(a, n) !== 1n) continue;
1029 if (phiFactors.every((q) => modPow(a, phi / q, n) !== 1n))
1030 return ce.number(a);
1031 }
1032 return undefined;
1033 },
1034 },
1035
1036 PrimeNumber: {
1037 description:
1038 'The nth prime number. `PrimeNumber` is an alias for `NthPrime`, which is the preferred name.',
1039 signature: '(integer) -> integer',
1040 canonical: ([n], { engine }) => engine._fn('NthPrime', [n]),
1041 },

Callers 1

number-theory.tsFile · 0.70

Calls 4

checkDeadlineFunction · 0.90
hasMethod · 0.65
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected