Public
Edited
Jun 10, 2024
Insert cell
Insert cell
function sum(n) {
if (n == 0) return 0;
return sum(n - 1) + n;
}
Insert cell
sum(1)
Insert cell
sum(2)
Insert cell
sum(3)
Insert cell
sum(4)
Insert cell
sum(5)
Insert cell
M = [0]
Insert cell
function sumP(n) {
if (n === 0) return 0;
M[n] = n + sumP(n-1);
return M[n];
}
Insert cell
sumP(99)
Insert cell
M
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