cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A062688 Smallest triangular number with digit sum n (or 0 if no such number exists).

Original entry on oeis.org

1, 0, 3, 0, 0, 6, 0, 0, 36, 28, 0, 66, 0, 0, 78, 0, 0, 378, 496, 0, 1596, 0, 0, 8385, 0, 0, 5778, 5995, 0, 8778, 0, 0, 47895, 0, 0, 67896, 58996, 0, 196878, 0, 0, 468996, 0, 0, 887778, 1788886, 0, 4896885, 0, 0, 5897895, 0, 0, 13999986, 15997996, 0, 38997696
Offset: 1

Views

Author

Erich Friedman, Jul 04 2001

Keywords

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)

Examples

			66 is the smallest triangular number with digit sum 12, so a(12)=66.
		

Crossrefs

Programs

  • 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 *)
  • 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