|
Search: id:A123895
|
|
|
| A123895 |
|
Restricted growth string for the (decimal expansion of the) number n. |
|
+0 4
|
|
| 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, 12, 12, 12, 12, 10, 12, 12, 11, 12, 12, 12, 12, 12, 12, 10, 12, 12, 12, 11, 12, 12, 12, 12, 12, 10, 12, 12, 12, 12, 11, 12, 12, 12, 12, 10, 12, 12, 12, 12, 12, 11, 12, 12
(list; graph; listen)
|
|
|
OFFSET
|
0,11
|
|
|
COMMENT
|
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 zeros.
|
|
REFERENCES
|
D. E. Knuth, TAOCP, Vol. 4, Section 7.2.1.5, Problems 4 and 5.
|
|
EXAMPLE
|
To find a(66041171): 066041171 -> 011023343 -> 11023343.
|
|
PROGRAM
|
(VBA program from Franklin T. Adams-Watters)
Public Function RestrictedGrowthString(ByVal x As String) As String
Dim i As Long
Dim dig As Integer
Dim pos As Long
For i = 1 To Len(x)
If Mid(x, i, 1) = "0" Then
RestrictedGrowthString = RestrictedGrowthString & "0"
Else
pos = InStr(x, Mid(x, i, 1))
If pos = i Then
dig = dig + 1
RestrictedGrowthString = RestrictedGrowthString &
Format(dig)
Else
RestrictedGrowthString = RestrictedGrowthString &
Mid(RestrictedGrowthString, pos, 1)
End If
End If
Next i
End Function
|
|
CROSSREFS
|
Cf. A123896, A123902.
Adjacent sequences: A123892 A123893 A123894 this_sequence A123896 A123897 A123898
Sequence in context: A108787 A097585 A063671 this_sequence A100830 A088475 A001637
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
njas, Nov 20 2006
|
|
|
Search completed in 0.002 seconds
|