UNPKG

maths.ts

Version:

Math utilities library for TypeScript, JavaScript and Node.js

25 lines (24 loc) 939 B
/** * Represents an array of prime numbers from 0 to 1100401, it helps to * prevent re-calculating every time an algorithm makes use of the * PRIMES of Eratosthenes algorithm. */ export declare const PRIMES: number[]; /** * Factorizes a number. * @param n The number to be factorize. * @return An array containing all prime factors of n. */ export declare function getPrimeFactors(n: number): number[]; /** * Gets the lowest common multiple for a set of numbers. * @param ns The numbers for calculating the lowest common multiple. * @return The lowest common multiple of all the numbers in the arguments. */ export declare function lcm(...ns: number[]): number; /** * Gets the greatest common divisor from a set of numbers. * @param ns The numbers from where to get the greatest common divisor. * @return The common denominator between all numbers in the arguments. */ export declare function gcd(...ns: number[]): number;