Skip to content

Instantly share code, notes, and snippets.

View kevindekemele's full-sized avatar

Kevin Dekemele kevindekemele

  • Ghent University
  • Ghent, Belgium
View GitHub Profile
@kevindekemele
kevindekemele / backdifference.js
Created July 11, 2017 09:04
Calculates the backward difference of an array.
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 July 11, 2017 09:04
Calculates the backward difference of an array.
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));