MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / nPrime

Method nPrime

__test__/theorem.js:1215–1229  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1213 return new BigNumber(n, base)
1214 }
1215 nPrime(n) {
1216 n = new BigNumber(n).toNumber()
1217 if (n < 1) {
1218 throw "[TheoremJS]: n is less than 1"
1219 }
1220 if (n > Number.MAX_SAFE_INTEGER) {
1221 throw `[TheoremJS] Input was larger than ${Number.MAX_SAFE_INTEGER}`
1222 }
1223 const gen = this.sieve()
1224 let out = 0
1225 for (var i = 0; i < n; i++) {
1226 out = gen.next().value
1227 }
1228 return new BigNumber(out)
1229 }
1230 get pi() {
1231 const digits = 15
1232 const Decimal = BigNumber.clone({ DECIMAL_PLACES: digits })

Callers

nothing calls this directly

Calls 1

sieveMethod · 0.95

Tested by

no test coverage detected