// --------------------------------------------------------------------- // CHECK_exceptions.magma // // David Niedbala Giraudin, ORCID 0009-0009-1526-1178. // Technical assistance: Claude (Anthropic). // // Independent recomputation, under Magma, of the set of integers that // are NOT a sum of three composite triangular numbers. // // A triangular number T_k = k(k+1)/2 is composite exactly when k >= 3, // so the admissible summands are T_3 = 6, T_4 = 10, T_5 = 15, ... // // Written for the Sydney online Magma calculator: one submission, inside // the 60 second limit. Raise LIMIT only if the budget allows; the whole // exceptional set is expected to lie below 195. // --------------------------------------------------------------------- LIMIT := 200000; // composite triangular numbers up to LIMIT T := []; k := 3; while k*(k+1) div 2 le LIMIT do Append(~T, k*(k+1) div 2); k +:= 1; end while; printf "composite triangular numbers up to %o : %o\n", LIMIT, #T; // S2[m+1] is true exactly when m = T_a + T_b with a, b >= 3 S2 := [false : i in [0..LIMIT]]; for i in [1..#T] do for j in [i..#T] do s := T[i] + T[j]; if s gt LIMIT then break; end if; S2[s+1] := true; end for; end for; print "two term table built"; exc := []; for n in [0..LIMIT] do ok := false; for t in T do if t gt n - 12 then break; end if; if S2[n-t+1] then ok := true; break; end if; end for; if not ok then Append(~exc, n); end if; end for; printf "number of exceptions below %o : %o\n", LIMIT, #exc; printf "%o\n", exc; print "expected: 41 values, the largest being 194";