Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Dekemele kevindekemele

  • Ghent University
  • Ghent, Belgium
View GitHub Profile
@kevindekemele
kevindekemele / backdifference.js
Created Jul 11, 2017
Calculates the backward difference of an array.
View backdifference.js
function factorial(x) {
if(x ===0) return 1;
return x === 1 || x ===0 ? x : x * factorial(x - 1) ;
}
function binomial (n, k) {
if (!Number.isInteger(n) || !Number.isInteger(k)) {
return false;
}
return factorial(n) / (factorial(k) * factorial(n-k));
@kevindekemele
kevindekemele / backdifference.js
Created Jul 11, 2017
Calculates the backward difference of an array.
View backdifference.js
function factorial(x) {
if(x ===0) return 1;
return x === 1 || x ===0 ? x : x * factorial(x - 1) ;
}
function binomial (n, k) {
if (!Number.isInteger(n) || !Number.isInteger(k)) {
return false;
}
return factorial(n) / (factorial(k) * factorial(n-k));