login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
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
Sequence in context: A179334 A068867 A068864 * A111704 A052041 A018884
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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 11:24 EDT 2024. Contains 371967 sequences. (Running on oeis4.)