login
Triangular numbers with sum of digits = 3.
8

%I #30 May 19 2022 09:22:13

%S 3,21,120,210,300,10011,20100,2001000,200010000,20000100000,

%T 2000001000000,200000010000000,20000000100000000,2000000001000000000,

%U 200000000010000000000,20000000000100000000000,2000000000001000000000000,200000000000010000000000000,20000000000000100000000000000

%N Triangular numbers with sum of digits = 3.

%C The sequence is unbounded, as the (2*10^k)-th triangular number is a term.

%H Michael S. Branicky, <a href="/A068127/b068127.txt">Table of n, a(n) for n = 1..504</a>

%t 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 *)

%t Select[Accumulate[Range[2*10^6]],Total[IntegerDigits[#]]==3&] (* _Harvey P. Dale_, Jun 22 2021 *)

%t Sort @ Select[Plus @@@ (10^Select[Tuples[Range[0, 29], 3], Min[Differences[#]] >= 0 &]), IntegerQ[Sqrt[8*# + 1]] &] (* _Amiram Eldar_, May 19 2022 *)

%o (Python)

%o from math import isqrt

%o from itertools import count, islice

%o def istri(n): return (lambda x: x == isqrt(x)**2)(8*n+1)

%o 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)))

%o print(list(islice(agen(), 20))) # _Michael S. Branicky_, May 14 2022

%Y Cf. A000217, A004157, A052217.

%K base,easy,nonn

%O 1,1

%A _Amarnath Murthy_, Feb 21 2002

%E More terms from _Sascha Kurz_, Mar 06 2002

%E One additional term (a(12)) from _Harvey P. Dale_, May 14 2022

%E More terms and offset changed to 1 from _Michael S. Branicky_, May 14 2022