OFFSET
1,1
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
EXAMPLE
12^2 = 144 has same digits as 21^2 = 441, so 12 and 21 are in the sequence.
PROG
(PARI) uptoqdigits(n) = { res = List(); for(i = 3, n, withqdigits(i); ); Set(res); }
withqdigits(n) = { my(l = List(), streak); for(i = sqrtint(10^(n-1)), sqrtint(10^n-1), listput(l, [vecsort(digits(i^2)), i])); listsort(l); print(#l); for(i = 1, #l-1, if(l[i][1] == l[i+1][1], listput(res, l[i][2]); streak = 1; , if(streak == 1, listput(res, l[i][2])); streak = 0)); if(streak == 1, listput(res, l[#l][2])); } \\ David A. Corneth, Aug 13 2021
(Python)
from math import isqrt
from itertools import count, islice
def agen(): # generator of terms
for d in count(3): # digits of square
seen, repeated = dict(), set()
for i in range(isqrt(10**(d-1)), isqrt(10**d-1)+1):
key = "".join(sorted(str(i*i)))
if key in seen: repeated.update([seen[key], i])
else: seen[key] = i
yield from sorted(repeated)
print(list(islice(agen(), 56))) # Michael S. Branicky, May 27 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved