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!)
A068855 a(1) = 1; a(n) is the smallest triangular number > a(n-1) which differs from it at every digit. 3

%I #22 Mar 20 2024 11:48:51

%S 1,3,6,10,21,36,45,66,78,91,105,210,325,406,528,630,703,820,903,1035,

%T 2211,3003,4186,5050,6105,7021,8256,9045,10153,21321,30135,41041,

%U 50403,61075,70500,82215,90100,101025,210276,303031,411778,500500,611065

%N a(1) = 1; a(n) is the smallest triangular number > a(n-1) which differs from it at every digit.

%H Michael S. Branicky, <a href="/A068855/b068855.txt">Table of n, a(n) for n = 1..2500</a>

%e 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.

%o (Python)

%o from math import isqrt

%o from itertools import count, islice

%o def alldiff(s, t):

%o return all(s[-i]!=t[-i] for i in range(1, min(len(s), len(t))+1))

%o def diffgreater(n): # smallest number >n that differs from it in every digit

%o s = str(n)

%o f = str(int(s[0]) + 1)

%o return int(f + "".join(("0" if di != "0" else "1") for di in s[1:]))

%o def agen(): # generator of terms

%o an = 1

%o while True:

%o yield an

%o t, s = isqrt(2*diffgreater(an)), str(an)

%o while (tt:=t*(t+1)//2)<an or not alldiff(s, str(tt)): t += 1

%o an = tt

%o print(list(islice(agen(), 45))) # _Michael S. Branicky_, Mar 20 2024

%Y Cf. A000217, A068853, A068854, A068865.

%K base,nonn

%O 1,2

%A _Amarnath Murthy_, Mar 12 2002

%E Corrected and extended by _Sascha Kurz_, Feb 02 2003

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 24 07:50 EDT 2024. Contains 371922 sequences. (Running on oeis4.)