code: function mOrder(base, modulus, max) {
      for (let i = 1; i < max || Number.MAX_SAFE_INTEGER; i++) {
          if (modPow(base, i, modulus) === 1) return i;
      }
      return 0;
  }
docs: console.log('4 pow 1 mod 7', modPow(4, 1, 7)); console.log('4 pow 2 mod 7', modPow(4, 2, 7)); console.log('4 pow 3 mod 7', modPow(4, 3, 7)); console.log('4 pow 4 mod 7', modPow(4, 4, 7)); 
  returns multiplicative order of *base* modulo *modulus*
  @param base
  @param modulus
  @param max
  @returns {number}