[go: up one dir, main page]

login
A161853
Primes which are anagrams of squares.
2
61, 163, 211, 487, 613, 619, 631, 691, 829, 1237, 1279, 1297, 1327, 1483, 1489, 1621, 1693, 1723, 1861, 2029, 2053, 2089, 2137, 2161, 2179, 2251, 2371, 2467, 2503, 2521, 2539, 2593, 2647, 2713, 2719, 2731, 2791, 2917, 2953, 2971, 3163, 3169, 3217, 3259
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
Sequence in context: A044393 A044774 A138627 * A106096 A142482 A007488
KEYWORD
nonn,base
AUTHOR
Claudio Meller, Jun 20 2009
STATUS
approved