OFFSET
1,1
COMMENTS
Given the n-th square, it is occasionally possible to form the (n+1)-th square using the same digits in a different order.
"Anagram" means that both squares must not only use the same digits but must use each digit the same number of times.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
169 and 196 are two successive squares.
MAPLE
with(numtheory):for n from 1 to 80000 do:p1:=n^2:p2:= (n+1)^2:pp1:=convert(p1, base, 10): pp2:=convert(p2, base, 10):n1:=sort(pp1):n2:=sort(pp2): if n1=n2 then printf(`%d, `, p1):else fi:od:
MATHEMATICA
lst = {}; k = 1; s = t = 0; ss = {0}; While[k < 155001, s = t; t += k; st = Sort@IntegerDigits@ t; If[ss == st, AppendTo[lst, s]]; ss = st; k += 2]; lst (* Robert G. Wilson v, Oct 24 2014 *)
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
ip, sp, hp = 0, 0, "0"
for i in count(1):
s = i*i
h = "".join(sorted(str(s)))
if h == hp: yield sp
ip, sp, hp = i, s, h
print(list(islice(agen(), 23))) # Michael S. Branicky, Feb 18 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Aug 12 2013
STATUS
approved