%I #20 Aug 02 2023 11:43:05
%S 1,10,28,91,190,496,820,946,1128,1275,2080,2211,2485,3321,4278,8128,
%T 8256,8778,9591,9730,11476,12090,12880,13203,13366,13530,15753,16471,
%U 17205,17578,20910,21115,21321,22791,24753,25651,27261,29890,30135,31626,33670,35245
%N Triangular numbers which are also happy numbers (cf. A007770).
%H Donovan Johnson, <a href="/A076712/b076712.txt">Table of n, a(n) for n = 1..1000</a>
%H Shyam Sunder Gupta <a href="http://www.shyamsundergupta.com/triangle.htm">Fascinating Triangular Numbers</a>
%e a(4)=91: 91 is a triangular number and also a happy number as 9^2+1^2=82, 8^2+2^2=68, 6^2+8^2=100 and 1^2+0^2+0^2=1. So 91 is triangular happy number.
%t Module[{nn=300,trnos,haps},trnos=Accumulate[Range[nn]];haps=Select[Range[ (nn(nn+1))/2], FixedPoint[ Total[IntegerDigits[#]^2]&,#,10]==1&];Intersection[ trnos,haps]] (* _Harvey P. Dale_, Aug 15 2014 *)
%o (Python)
%o from itertools import count, islice
%o def A076712_gen(): # generator of terms
%o for n in count(1):
%o m = t = n*(n+1)>>1
%o while m not in {1,37,58,89,145,42,20,4,16}:
%o m = sum((0, 1, 4, 9, 16, 25, 36, 49, 64, 81)[ord(d)-48] for d in str(m))
%o if m == 1:
%o yield t
%o A076712_list = list(islice(A076712_gen(),20)) # _Chai Wah Wu_, Aug 02 2023
%Y Cf. A000217, A007770.
%K nonn,base
%O 1,2
%A _Shyam Sunder Gupta_, Oct 26 2002