OFFSET
1,2
LINKS
David A. Corneth, Table of n, a(n) for n = 1..2200
David A. Corneth, PARI program
EXAMPLE
225 is a term and the next few squares are 256, 289, 324, 361, 400, 441, ...; 361 is the smallest one which differs from 225 in all corresponding digit positions.
PROG
(PARI) \\ See PARI link
(Python)
from math import isqrt
from itertools import count, islice
def alldiff(s, t):
return all(s[-i]!=t[-i] for i in range(1, min(len(s), len(t))+1))
def diffgreater(n): # smallest number >n that differs from it in every digit
s = str(n)
f = str(int(s[0]) + 1)
return int(f + "".join(("0" if di != "0" else "1") for di in s[1:]))
def agen(): # generator of terms
an = 1
while True:
yield an
r, s = isqrt(diffgreater(an)), str(an)
while not alldiff(s, str(r*r)): r += 1
an = r*r
print(list(islice(agen(), 45))) # Michael S. Branicky, Mar 20 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Mar 12 2002
EXTENSIONS
Name corrected by Jon E. Schoenfield, Oct 27 2023
a(9) onward corrected by Sean A. Irvine, Mar 18 2024
STATUS
approved