math-operations

1.1.0 • Public • Published

Math Operations

Math Operations is a module with lots of mathematical operations.

Installation

npm install math-operations

Importing

const mathOps = require('math-operations');  

Usage

Factorial
Returns the factorial of the number sent as parameter.

mathOps.factorial(5);

Fibonacci
Returns the fibonacci of the number sent as parameter.

mathOps.fibonacci(5);

Sum
Return the sum of the numbers sent as parameters.

mathOps.sum(1, 8, 5, 2);

Bubble Sort
Return the array sent as parameter sorted with bubble sort algorithm.

mathOps.bubbleSort([8, 2, 3, 1]);

Perfect Numbers
Return true case the number sent as parameter is perfect.

mathOps.isPerfect(6);

Prime Numbers
Return true case the number sent as parameter is prime.

mathOps.isPrime(7);

Even or Odd
Two different methods that return a boolean according to the parameter sent.

Returns true case the number sent as parameter is an even number
mathOps.isEven(4);
Returns true case the number sent as parameter is an odd number
mathOps.isOdd(3);

/math-operations/

    Package Sidebar

    Install

    npm i math-operations

    Weekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    9.42 kB

    Total Files

    7

    Last publish

    Collaborators

    • mgenteluci