@u4/prime
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@u4/prime

NPM Version

This small package contains simple prime number utilities with no extra stuff.

why an other simple prime number tester / generator

I'm publishing this package because no available prime's number package have the required quality or features to be used. I only need to find some random prime numbers to loop over ℤ/nℤ ring.

I tryed a lot's of implementations

Name Size in node_modules Observation
prime-number 28kB store all vistited values in memory, contains only isPrime function
nprime 776kB too large + recursive implenetation
prime-nummers 4840kB 4840 KB WTF !!
prime-q 54280kB 54MB !!
prime-number-boolean 24kB using +1 loop + dirty code
is-prime-number 24kB using +1 in test loop + have typing
prime-number-search 48kB works with string but do not support big numbers so, useless
prime_numbers 16kB console.log results +1 loop, do not return result !

How it works

Using default import

import isPrime from '@u4/prime';
console.log(isPrime(7))

Using named import

import {isPrime, nextPrime, prevPrime} from '@u4/prime';
console.log(isPrime(7))

Using * as import

import * as Prime from '@u4/prime';
console.log(Prime.isPrime(7))

Package Sidebar

Install

npm i @u4/prime

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.64 kB

Total Files

5

Last publish

Collaborators

  • urielch