Public
Edited
Feb 17, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data.slice(-1)
Insert cell
data = {
let a = [];
let d = {
x: 0,
factorial: BigInt(1)
}
function stirlingApproximation(x) {
x = Number(x);
return Math.sqrt(2*Math.PI) * (x ** (x+0.5)) * Math.exp(-x) * (1+1/(12*x)+1/(288*x*x));
}
for (let x = 1 ; x <= range ; x++) {
d = {
x,
factorial: d.factorial * BigInt(x),
Stirling: stirlingApproximation(x),
};
d.repeatedFactorialApproximation = x < 3 ? x : Math.round(stirlingApproximation(d.factorial));
a.push(d);
}
return a;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more