Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function f(x, a) {
return (x % a !== 0 && x % 21 === 0) <= (x % 14 !== 0);
}
Insert cell
answer = solve()
Insert cell
function solve() {
for (let a = 1000, isGood = true; a >= 1; a--, isGood = true) {
for (let x = 1; x <= 1000; x++) {
if (!f(x, a)) {
isGood = false;
break;
}
}
if (isGood) return a;
}
}
Insert cell
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