ocaml: phase 5.1 euler30_cube.ml baseline (sum of digit-cube narcissistic numbers <= 999 = 1301)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

Numbers equal to the sum of cubes of their digits:
  153 = 1 + 125 + 27
  370 = 27 + 343 + 0
  371 = 27 + 343 + 1
  407 = 64 + 0 + 343
  sum = 1301

Implementation:
  pow_digit_sum n p   walk digits of n, accumulate d^p
  euler30 p limit     scan 2..limit and sum where pow_digit_sum n p = n

Real PE30 uses 5th powers (answer 443839); the cube version
exercises the same algorithm in a smaller search space.

118 baseline programs total.
This commit is contained in:
2026-05-09 23:17:00 +00:00
parent ea7120751d
commit 46e49dc947
3 changed files with 28 additions and 0 deletions

View File

@@ -407,6 +407,11 @@ _Newest first._
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
'a tree`) with insert + in-order traversal. Tests parametric ADT,
recursive match, List.append, List.fold_left.
- 2026-05-09 Phase 5.1 — euler30_cube.ml baseline (sum of numbers
equal to sum of cubes of their digits, ≤999 = 1301). The full
numbers are 153 + 370 + 371 + 407 = 1301. PE30 proper uses 5th
powers (answer 443839); cube version exercises the same algorithm
in a smaller search space. 118 baseline programs total.
- 2026-05-09 Phase 5.1 — euler28.ml baseline (sum of diagonals in
7x7 number spiral = 261). For each layer (1..(n-1)/2) the four
corners are spaced 2*layer apart, so we step `k` four times per