login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A123895 Restricted growth string for the (decimal expansion of the) number n. 3
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; refs; listen; history; internal format)
OFFSET

0,11

COMMENTS

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, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Section 7.2.1.5, p. 432, Problems 4 and 5.

EXAMPLE

To find a(66041171): 066041171 -> 011023343 -> 11023343.

PROG

(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.

Sequence in context: A063671 A184992 A162501 * A147519 A100830 A180176

Adjacent sequences:  A123892 A123893 A123894 * A123896 A123897 A123898

KEYWORD

nonn,base

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Nov 20 2006

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 17 09:17 EST 2012. Contains 206009 sequences.