Files
rose-ash/lib/ocaml
giles 5959989324
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
ocaml: phase 5.1 euler25.ml baseline (first 12-digit Fibonacci index = 55)
Iteratively grows two refs while the larger is below 10^(n-1),
counting iterations:

  let euler25 n =
    let a = ref 1 in
    let b = ref 1 in
    let i = ref 2 in
    let target = ref 1 in
    for _ = 1 to n - 1 do target := !target * 10 done;
    while !b < !target do
      let c = !a + !b in
      a := !b;
      b := c;
      i := !i + 1
    done;
    !i

  euler25 12 = 55   (F(55) = 139_583_862_445, 12 digits)

Real PE25 asks for 1000 digits (answer 4782); 12 keeps within
safe-int while exercising the identical algorithm.

114 baseline programs total — 200 iterations landed.
2026-05-09 22:31:27 +00:00
..