|
|
A068854
|
|
a(1) = 1; a(n) is the smallest square > a(n-1) which differs from it at every digit.
|
|
4
|
|
|
1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 225, 361, 400, 529, 676, 729, 841, 900, 1024, 2116, 3025, 4356, 5041, 6400, 7056, 8100, 9025, 10201, 21025, 30276, 42025, 50176, 61009, 70225, 81796, 90000, 101124, 210681, 302500, 410881, 501264, 613089, 702244, 810000
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|