UNPKG

theorem.js

Version:

A Math library for computation in JavaScript

9 lines (8 loc) 153 B
isPrime(n) { n = new BigNumber(n).abs() const leastFactor = this.leastFactor(n) if (n.eq(leastFactor) && n.gte(2)) { return true } return false }