mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 15:39:42 +08:00
@ -7,7 +7,7 @@
|
||||
|
||||
/**
|
||||
* @function findBinomialCoefficient
|
||||
* @description -> this function returns bonimial coefficient
|
||||
* @description -> this function returns binomial coefficient
|
||||
* of two numbers n & k given by n!/((n-k)!k!)
|
||||
* @param {number} n
|
||||
* @param {number} k
|
||||
|
@ -37,7 +37,7 @@ const CheckKishnamurthyNumber = (number) => {
|
||||
sumOfAllDigitFactorial += factorial(lastDigit)
|
||||
newNumber = Math.floor(newNumber / 10)
|
||||
}
|
||||
// if the sumOftheFactorial is equal to the given number it means the number is a Krishnamurthy number.
|
||||
// if the sumOfAllDigitFactorial is equal to the given number it means the number is a Krishnamurthy number.
|
||||
return sumOfAllDigitFactorial === number
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Problem statement and explanation: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
|
||||
*
|
||||
* This algorithm plays an important role for modular arithmetic, and by extension for cyptography algorithms
|
||||
* This algorithm plays an important role for modular arithmetic, and by extension for cryptography algorithms
|
||||
*
|
||||
* Basic explanation:
|
||||
* The Extended Euclidean algorithm is a modification of the standard Euclidean GCD algorithm.
|
||||
|
@ -21,7 +21,7 @@
|
||||
* 1 / 2^50 = 8.8 * 10^-16 (a pretty small number)
|
||||
*
|
||||
* For comparison, the probability of a cosmic ray causing an error to your
|
||||
* infalible program is around 1.4 * 10^-15. An order of magnitude below!
|
||||
* infallible program is around 1.4 * 10^-15. An order of magnitude below!
|
||||
*
|
||||
* But because nothing is perfect, there's a major flaw to this algorithm, and
|
||||
* the cause are the so called Carmichael Numbers. These are composite numbers n
|
||||
|
@ -9,7 +9,7 @@ describe('tests for mean absolute deviation', () => {
|
||||
expect(() => meanAbsoluteDeviation('fgh')).toThrow()
|
||||
})
|
||||
|
||||
it('should return the mean absolute devition of an array of numbers', () => {
|
||||
it('should return the mean absolute deviation of an array of numbers', () => {
|
||||
const meanAbDev = meanAbsoluteDeviation([2, 34, 5, 0, -2])
|
||||
expect(meanAbDev).toBe(10.479999999999999)
|
||||
})
|
||||
|
Reference in New Issue
Block a user