{
const dividend = n;
const decimals = 20;
const wScale = 2;
const hScale = 20;
const rows = [];
for(let i = 1; i < steps + 1; i++) {
const digits = (dividend/i).toFixed(Math.min(100,decimals)).split('.').pop().split('');
rows.push(new Uint16Array(digits));
}
const w = steps * wScale, h = decimals * hScale;
const c = DOM.context2d(w, h, 1);
c.canvas.style.maxWidth = '100%';
for(let x = 0; x < steps; x++) {
for(let y = 0; y < decimals; y++) {
const col = getColor(rows[x][y], y);
c.fillStyle = `hsl(${col.h*360|0},${col.s*100|0}%,${col.l*100|0}%)`;
c.fillRect(x * wScale, y * hScale, wScale, hScale);
}
}
return c.canvas;
function getColor(d, i) {
const l = .5 - (i / decimals) * .4;
return { h: d / 10, s: l * 2, l};
}
}