packages/qiskit-devs-js/lib/factor.js
function determineFrequency(fu) {
    let qstate = new qubits.QState(numInBits + numOutBits).hadamard(inputBits);
    qstate = qstate.applyFunction(inputBits, outBits, fu);
    // We do not need to measure the outBits, but it does speed up the simulation.
    qstate = qstate.measure(outBits).newState;

    return qstate.qft(inputBits).measure(inputBits).result;
  }
function determineFrequency(fu) {
    let qstate = new qubits.QState(numInBits + numOutBits).hadamard(inputBits);
    qstate = qstate.applyFunction(inputBits, outBits, fu);
    // We do not need to measure the outBits, but it does speed up the simulation.
    qstate = qstate.measure(outBits).newState;

    return qstate.qft(inputBits).measure(inputBits).result;
  }
Quantum computation It returns either the frequency of the function f or some integer multiple (where "frequency" is the number of times the period of f will fit into 2^numInputBits)