OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..2500
EXAMPLE
325 belongs to this sequence and the next few triangular numbers are 351, 378, 406, 435; 406 is the smallest one which differs from 325 in all corresponding digit positions.
PROG
(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
t, s = isqrt(2*diffgreater(an)), str(an)
while (tt:=t*(t+1)//2)<an or not alldiff(s, str(tt)): t += 1
an = tt
print(list(islice(agen(), 45))) # Michael S. Branicky, Mar 20 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Mar 12 2002
EXTENSIONS
Corrected and extended by Sascha Kurz, Feb 02 2003
STATUS
approved