UNPKG

@nexys/math-ts

Version:

[![npm version](https://badge.fury.io/js/%40nexys%2Fmath-ts.svg)](https://www.npmjs.com/package/@nexys/math-ts) [![TavisCI](https://travis-ci.com/Nexysweb/tableau-wdc-react.svg?branch=master)](https://travis-ci.com/github/Nexysweb/math-ts) [![Deployment](

24 lines (23 loc) 540 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPrime = (i, p) => { if (p.length > 0) { if (i % p[0] === 0 && i !== p[0]) { return false; } const d = p.slice(1, p.length); return exports.isPrime(i, d); } return true; }; exports.prime = (n) => { const p = [3, 5]; let i = 7; while (i < n) { if (i % 10 !== 5 && exports.isPrime(i, p)) { p.push(i); } i = i + 2; } return [1, 2].concat(p); };