<commit_before>'use strict';
const BigNumber = require('bignumber.js');

/** 
 * Returns the remainder of the base raised to the exponent power, divided by the modulo
 * See: https://en.wikipedia.org/wiki/Modular_exponentiation
 * @param {Number} base
 * @param {Number} exponent
 * @param {Number} modulo
 * @returns {Number}
 */
exports.modularExponentiation = (base, exponent, modulo) => {
  // TODO: see if there is a more efficient way to calculate than using BigNumber
  return new BigNumber(base).pow(exponent, modulo).toNumber();
};<commit_msg>Project Euler 48<commit_after>'use strict';

/**
 * Returns the remainder of the base raised to the exponent power, divided by the modulo
 * See: https://en.wikipedia.org/wiki/Modular_exponentiation
 * @param {Number} base
 * @param {Number} exponent
 * @param {Number} modulo
 * @returns {Number}
 */
exports.modularExponentiation = (base, exponent, modulo) => {
  let i = 1;
  let result = 1;
  while (i <= exponent) {
    result = (result * base) % modulo;
    i++;
  }
  return result;
};
{'fraction_non_alphanumeric': 0.13218390804597702, 'fraction_numerical': 0.0038314176245210726, 'mean_word_length': 4.173267326732673, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3382784', 'n_tokens_mistral': 325, 'n_tokens_neox': 310, 'n_words': 107}