Public
Edited
Dec 1, 2023
Insert cell
Insert cell
Insert cell
MD5Lib = require("hash-wasm@4.11.0/dist/md5.umd.min.js")
Insert cell
Insert cell
async function findNextCoin(salt, numZeros = 5) {
const prefix = "0".repeat(numZeros);
for (let i = 0; i < 9999999; i++) {
const hash = await MD5Lib.md5(salt + i);
if (hash.startsWith(prefix)) {
return i;
}
}
}
Insert cell
part1 = findNextCoin(puzzleInput)
Insert cell
Insert cell
Insert cell
Insert cell
part2 = findNextCoin(puzzleInput, 6)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
puzzleInput = `iwrupvqb`
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