login
A068855
a(1) = 1; a(n) is the smallest triangular number > a(n-1) which differs from it at every digit.
3
1, 3, 6, 10, 21, 36, 45, 66, 78, 91, 105, 210, 325, 406, 528, 630, 703, 820, 903, 1035, 2211, 3003, 4186, 5050, 6105, 7021, 8256, 9045, 10153, 21321, 30135, 41041, 50403, 61075, 70500, 82215, 90100, 101025, 210276, 303031, 411778, 500500, 611065
OFFSET
1,2
LINKS
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