%I #8 Feb 18 2024 13:44:22
%S 3,19,109,163,307,523,613,631,1063,1117,1171,1567,1657,1693,1783,1801,
%T 1873,2017,2251,2269,2287,2521,2683,3061,3079,3169,3187,3457,3547,
%U 3691,3709,3907,4051,4357,4861,5077,5167,5347,5437,5563,5581,5653,5743,5851
%N Primes that are anagrams of triangular numbers.
%C 19 is an anagram of 91 = T(13) = 13*14/2.
%C 163, 613 and 631 are anagrams of 136 = T(16) = 16*17/2.
%H Michael S. Branicky, <a href="/A162354/b162354.txt">Table of n, a(n) for n = 1..10000</a>
%o (Python)
%o from sympy import primerange
%o from itertools import count, takewhile
%o def hash(n): return "".join(sorted(str(n)))
%o def aupto_digits(d):
%o tris = takewhile(lambda x:x<10**d, (i*(i+1)//2 for i in count(0)))
%o primes = primerange(1, 10**d)
%o T = set(map(hash, tris))
%o return [p for p in primes if hash(p) in T]
%o print(aupto_digits(4)) # _Michael S. Branicky_, Feb 18 2024
%K nonn,base
%O 1,1
%A _Claudio Meller_, Jul 01 2009
%E Corrected by _Claudio Meller_, Jul 08 2009