import { JSX } from "preact"; import { Main, render_and_copy } from "./common.tsx"; const Bar = ({ color, animation_time, side, }: { color: string; animation_time: number; side: "left" | "right"; }): JSX.Element => (
); function coprime(a: number, b: number): boolean { if (a == b) return false; for (let i = 2; i < Math.min(a, b); i++) { if (a % i == 0 && b % i == 0) { return false; } } return true; } function next_coprime(ns: number[]): number { if (ns.length == 0) return 2; for (let a = ns.at(-1) ?? 0; ; a++) { let good = true; for (const b of ns) { if (!coprime(a, b)) good = false; } if (good) return a; } } function gen_coprimes(to: number): number[] { if (to <= 0) return []; if (to == 1) return [2]; const xs = gen_coprimes(to - 1); return [...xs, next_coprime(xs)]; } const BarPair = ({ color, animation_time, num_bars, }: { color: string; animation_time: number; num_bars: number; }): JSX.Element => ( ); const Bars = ({ colors }: { colors: string[] }): JSX.Element => (