UNPKG

primejs

Version:

A library for prime number miscellany

19 lines (17 loc) 363 B
var math = require('mathjs'); module.exports.PrimeCounting = { /** * Legendre prime counting function with B = 1 * * @param Number or String * @return math.bignumber */ Legendre: function(x) { var y = math.bignumber(x.toString()); return math.chain(y) .divide( math.subtract(math.log(y), 1) ) .done(); } };