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 A123895 #27 Jul 24 2021 01:13:33 %S A123895 0,1,1,1,1,1,1,1,1,1,10,11,12,12,12,12,12,12,12,12,10,12,11,12,12,12, %T A123895 12,12,12,12,10,12,12,11,12,12,12,12,12,12,10,12,12,12,11,12,12,12,12, %U A123895 12,10,12,12,12,12,11,12,12,12,12,10,12,12,12,12,12,11,12,12 %N A123895 Restricted growth string for the (decimal expansion of the) number n. %C A123895 Write n in base 10 prefixed with a 0. Read this string from left to right. Write a 0 each time you see the first distinct digit (which is 0), write a 1 each time you see the second distinct digit, write a 2 each time you see the third distinct digit and so on. Finally, delete the leading 0's. %D A123895 D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.5, p. 432, Problems 4 and 5. %H A123895 Michael De Vlieger, <a href="/A123895/b123895.txt">Table of n, a(n) for n = 0..10000</a> %e A123895 To find a(66041171): 066041171 -> 011023343 -> 11023343. %p A123895 read("transforms"): %p A123895 A123895 := proc(n) %p A123895 local dgs,Lmap,idx,dig,pos,Lredu ; %p A123895 dgs := [op(convert(n,base,10)) ,0]; %p A123895 Lmap := [] ; %p A123895 for idx from -1 to -nops(dgs) by -1 do %p A123895 dig := op(idx,dgs) ; %p A123895 if not member(dig,Lmap) then %p A123895 Lmap := [op(Lmap),dig] ; %p A123895 end if; %p A123895 end do: %p A123895 Lredu := [] ; %p A123895 for idx from -1 to -nops(dgs) by -1 do %p A123895 member(op(idx,dgs),Lmap,'pos') ; %p A123895 Lredu := [op(Lredu),pos-1] ; %p A123895 end do: %p A123895 digcatL(Lredu) ; %p A123895 end proc: %p A123895 seq(A123895(n),n=0..60) ; # _R. J. Mathar_, Dec 09 2015 %t A123895 f[n_] := Block[{d = Prepend[IntegerDigits@ n, 0], a, b, w}, b = DeleteDuplicates@ d; a = Range[0, Length@ b]; w = FromDigits@ Flatten[Part[a, FirstPosition[b, #]] & /@ d]; w]; Table[f@ n, {n, 0, 67}] (* _Michael De Vlieger_, Dec 09 2015, Version 10 *) %o A123895 (VBA) %o A123895 Public Function RestrictedGrowthString(ByVal x As String) As String %o A123895 Dim i As Long %o A123895 Dim dig As Integer %o A123895 Dim pos As Long %o A123895 For i = 1 To Len(x) %o A123895 If Mid(x, i, 1) = "0" Then %o A123895 RestrictedGrowthString = RestrictedGrowthString & "0" %o A123895 Else %o A123895 pos = InStr(x, Mid(x, i, 1)) %o A123895 If pos = i Then %o A123895 dig = dig + 1 %o A123895 RestrictedGrowthString = RestrictedGrowthString & %o A123895 Format(dig) %o A123895 Else %o A123895 RestrictedGrowthString = RestrictedGrowthString & %o A123895 Mid(RestrictedGrowthString, pos, 1) %o A123895 End If %o A123895 End If %o A123895 Next i %o A123895 End Function %o A123895 ' _Franklin T. Adams-Watters_ %Y A123895 Cf. A123896, A123902. %K A123895 nonn,base %O A123895 0,11 %A A123895 _N. J. A. Sloane_, Nov 20 2006