A068127 Triangular numbers with sum of digits = 3.
3, 21, 120, 210, 300, 10011, 20100, 2001000, 200010000, 20000100000, 2000001000000, 200000010000000, 20000000100000000, 2000000001000000000, 200000000010000000000, 20000000000100000000000, 2000000000001000000000000, 200000000000010000000000000, 20000000000000100000000000000
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..504
Programs
-
Mathematica
t = {}; Do[tri = n*(n+1)/2; If[Total[IntegerDigits[tri, 10]] == 3, AppendTo[t, tri]], {n, 1000000}]; t (* T. D. Noe, Jun 05 2012 *) Select[Accumulate[Range[2*10^6]],Total[IntegerDigits[#]]==3&] (* Harvey P. Dale, Jun 22 2021 *) Sort @ Select[Plus @@@ (10^Select[Tuples[Range[0, 29], 3], Min[Differences[#]] >= 0 &]), IntegerQ[Sqrt[8*# + 1]] &] (* Amiram Eldar, May 19 2022 *)
-
Python
from math import isqrt from itertools import count, islice def istri(n): return (lambda x: x == isqrt(x)**2)(8*n+1) def agen(): yield from filter(istri, (10**i + 10**j + 10**k for i in count(0) for j in range(i+1) for k in range(j+1))) print(list(islice(agen(), 20))) # Michael S. Branicky, May 14 2022
Extensions
More terms from Sascha Kurz, Mar 06 2002
One additional term (a(12)) from Harvey P. Dale, May 14 2022
More terms and offset changed to 1 from Michael S. Branicky, May 14 2022
Comments