OFFSET
1,1
COMMENTS
211 is in the sequence because it is a prime number and 121 (an anagram of 211) is a square: 11*11.
829 is in the sequence because it is a prime number and 289 (an anagram of 829) is a square: 17*17.
409 is NOT in the sequence because, although it is a prime and 49 is a square, 49 is not an anagram of 409 because it does not contain the digit zero. In other words, an anagram of a prime, for purposes of this sequence, must have the same number of digits as the prime has. - Harvey P. Dale, Aug 29 2017
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10923 (all terms with <= 6 digits; terms 1..1000 from Harvey P. Dale)
MATHEMATICA
pasQ[n_]:=AnyTrue[Sqrt[#]&/@Select[FromDigits/@Permutations[ IntegerDigits[ n]], IntegerLength[#]==IntegerLength[n]&], IntegerQ]; Select[Prime[ Range[ 500]], pasQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 29 2017 *)
PROG
(Python)
from sympy import primerange
from itertools import count, takewhile
def hash(n): return "".join(sorted(str(n)))
def aupto_digits(d):
squares = takewhile(lambda x:x<10**d, (i*i for i in count(1)))
primes = primerange(1, 10**d)
S = set(map(hash, squares))
return [p for p in primes if hash(p) in S]
print(aupto_digits(4)) # Michael S. Branicky, Feb 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Claudio Meller, Jun 20 2009
STATUS
approved