Files
rose-ash/lib/ocaml/baseline
giles da96a79104
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
ocaml: phase 5.1 abundant.ml baseline (count abundant numbers < 100 = 21)
A number n is abundant if its proper-divisor sum exceeds n. Reuses
the trial-division div_sum helper:

  let count_abundant n =
    let c = ref 0 in
    for i = 12 to n - 1 do
      if div_sum i > i then c := !c + 1
    done;
    !c

  count_abundant 100 = 21

Abundant numbers under 100, starting at 12, 18, 20, 24, 30, 36, 40,
42, 48, 54, 56, 60, 66, 70, 72, 78, 80, 84, 88, 90, 96 -> 21.

Companion to euler21_small.ml (amicable). The classification:
  perfect:  d(n) = n   (e.g. 6, 28)
  abundant: d(n) > n   (e.g. 12, 18)
  deficient:d(n) < n   (everything else)

124 baseline programs total.
2026-05-10 00:36:29 +00:00
..