Public
Edited
Jun 4, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
out = {
var gates = Array(n).fill(false)

for (var i = 1; i <= n; i++) {
for (var j = 1; j <= n; j++) {
if (j % i) {
gates[j - 1] = !gates[j - 1]
}
}
}

return md`${gates.map((g, i) => g ? i + 1 : 0).filter(i => i != 0).join(" ")}`
}
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