This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A383789 #26 May 18 2025 07:56:53 %S A383789 1,10,100,11,101,12,2,20,102,13,3,23,103,14,4,24,104,15,5,25,105,16,6, %T A383789 26,106,17,7,27,107,18,8,28,108,19,9,29,109,21,110,30,113,31,111,41, %U A383789 112,22,120,32,121,42,114,34,123,33,130,35,115,45,124,40,134,36,116,46,126,51,117,37,127,47,137 %N A383789 a(1) = 1; for n > 1, a(n) is the smallest positive integer not already in the sequence such that it shares at least one digit with a(n-1), and it has a different number of digits from a(n-1). %H A383789 Vincenzo Librandi, <a href="/A383789/b383789.txt">Table of n, a(n) for n = 1..1000</a> %e A383789 a(6) = 12, and 2 is the smallest number not already in the sequence that shares a digit with 12 and has a different number of digits. So, a(7) = 2. %t A383789 a[1] = 1; a[n_] := a[n] = Module[{k = 2, s = Array[a, n-1], d = IntegerDigits[a[n-1]], m = IntegerLength[a[n-1]]}, While[! FreeQ[s, k] || Intersection[IntegerDigits[k], d] == {} || IntegerLength[k] == m, k++]; k]; Array[a, 100] (* _Amiram Eldar_, May 10 2025 *) %o A383789 (PARI) isok(k, nbd, s, va) = if (#select(x->(x==k), va), return(0)); my(d=digits(k)); if (#setintersect(Set(d), s) && (#d != nbd), return(1)); %o A383789 find(va, n) = my(k=2, d=digits(va[n-1]), nbd=#d, s=Set(d)); while (!isok(k, nbd, s, va), k++); k; %o A383789 lista(nn) = my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = find(va, n);); va; \\ _Michel Marcus_, May 13 2025 %o A383789 (Magma) function MySequence(N) a := [1]; while #a lt N do prev := a[#a]; d := Intseq(prev); m := #d; k := 2; repeat is_used := k in a; inter := &and[not x in d : x in Intseq(k)]; len_eq := #Intseq(k) eq m; k +:= 1; until not is_used and not inter and not len_eq; Append(~a, k - 1); end while; return a; end function; MySequence(100); // _Vincenzo Librandi_, May 17 2025 %Y A383789 Cf. A184992, A303848. %K A383789 nonn,base %O A383789 1,2 %A A383789 _Ali Sada_, May 09 2025