Data Types
Number

Number

Reverse the number

import { reverseNumber } from "quark-dsa";
 
let num = 5698;
reverseNumber(num); // returns 8965

Check a number is prime number

import { isPrime } from "quark-dsa";
 
let num = 37019;
isPrime(num); // returns true;

Check a number is palindrome

import { isNumberPalindrome } from "quark-dsa";
 
let num = 1562651;
isNumberPalindrome(num); // returns true;

Factorial of a number.

import { factorial } from "quark-dsa";
 
factorial(5); // returns 120;
factorial(15); // returns 1307674368000

Permutations of the list

You can get number of possibilities of selecting k entities out of set of n entities. It will give you the result of nPk.

import { permutations } from "quark-dsa";
 
permutations(5, 2); //returns 20
permutations(12, 2); // returns 132

Combinations of the list

You can get number of arrangements of k entities out of set of n entities. It will give you the result of nCk.

import { combinations } from "quark-dsa";
 
combinations(5, 2); //returns 10
combinations(12, 2); // returns 66