MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / findP

Function findP

Maths/ShorsAlgorithm.js:64–68  ·  view source on GitHub ↗

* @function findP * @description Finds a value p such that A^p = mB + 1. * @param {BigInt} A * @param {BigInt} B * @returns The value p.

(A, B)

Source from the content-addressed store, hash-verified

62 * @returns The value p.
63 */
64function findP(A, B) {
65 let p = 1n
66 while (!isValidP(A, B, p)) p++
67 return p
68}
69
70/**
71 * @function isValidP

Callers 1

ShorsAlgorithmFunction · 0.85

Calls 1

isValidPFunction · 0.85

Tested by

no test coverage detected