OFFSET
1,3
COMMENTS
From Jon E. Schoenfield, Dec 04 2021: (Start)
a(n) = 0 iff n == (2,4,5,7,8) mod 9.
Nonzero terms are not nondecreasing; e.g., a(9)=36 > a(10)=28.
(End)
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..168
EXAMPLE
66 is the smallest triangular number with digit sum 12, so a(12)=66.
MATHEMATICA
(With[{tbl={#, Total[IntegerDigits[#]]}&/@Accumulate[Range[9000]]}, Table[SelectFirst[ tbl, #[[2]] ==n&], {n, 60}]]/.Missing["NotFound"]->{0, 0})[[;; , 1]] (* Harvey P. Dale, Aug 21 2024 *)
PROG
(PARI) a(n) = if (vecsearch([2, 4, 5, 7, 8], n % 9), return (0)); my(k=1); while (sumdigits(k*(k+1)/2) != n, k++); k*(k+1)/2; \\ Michel Marcus, Dec 12 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Erich Friedman, Jul 04 2001
STATUS
approved