%I #13 Feb 18 2024 13:28:40
%S 0,120,4095,36046,147153,219453,1021735,1053426,104653,10149765,
%T 10294453,10348975,100486576,10725396,103428153,20759346,12347965,
%U 100174935,129548656,102968425,104697685,102925378,160249753,123865930,126047503,102538360,224073865
%N Smallest triangular number with exactly n anagrams that are triangular numbers.
%H Michael S. Branicky, <a href="/A166596/b166596.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..46 from Chai Wah Wu)
%e n=1, {0} (triangular number with no nontrivial anagram)
%e n=2, {120,210} (two anagrams of triangular numbers)
%e n=3, {4095,4950,9045} (three anagrams of triangular numbers)
%e n=4, {36046,43660,46360,66430} (four anagrams of triangular numbers)
%e n=5, {147153,375411,435711,713415,741153}
%e n=6, {219453,243951,432915,493521,539241,943251}
%e n=7, {1021735,1710325,2310175,2375110,3201715,5312170,7321051}
%e n=8, {1053426,1345620,1360425,1405326,1624503,2465310,5643120,6503421}
%e n=9, {104653,135460,354061,403651,406351,431056,465130,534061,634501}
%e n=10, {10149765,14609715,15149760,16974051,17461095,17609145,41509716,41591760, 41756091,61710495}.
%o (Python)
%o from math import isqrt
%o from collections import Counter
%o from itertools import count, islice, combinations_with_replacement as mc
%o def tris(d): # generator of triangular numbers with d digits
%o ilb, lb, ub = isqrt(2*10**(d-1))-1, 10**(d-1), 10**d
%o if d == 1: yield 0
%o for i in count(ilb):
%o t = i*(i+1)//2
%o if t < lb: continue
%o elif t >= ub: break
%o yield t
%o def agen(): # generator of sequence terms
%o n, adict = 1, dict()
%o for d in count(1):
%o c = Counter("".join(sorted(str(t))) for t in tris(d))
%o for t in tris(d):
%o v = c["".join(sorted(str(t)))]
%o if v not in adict: adict[v] = t
%o while n in adict: yield adict[n]; n += 1
%o print(list(islice(agen(), 46))) # _Michael S. Branicky_, Feb 18 2024
%Y Cf. A034291 Triangular numbers that have some nontrivial permutation of digits which is also triangular.
%K base,nonn
%O 1,2
%A _Zak Seidov_, Oct 17 2009
|