# Finding a formula for a pattern

I have this pattern which is an infinite sequence (I have placed commas so it's easy to see the pattern)...

$1 ,1 2, 1 2 3, 1 2 3 4, 1 2 3 4 5 ...$

Is there any formula governing this sequence, ie, If I gave you an index, would you be able to run it through a formula that outputs the digit at that index?

• FYI: oeis.org/A007908 – mathlove Aug 30 '14 at 12:38
• What happens after 123456789? is it 1234567890, 12345678901, and so on? or is it 12345678910, 1234567891011, and so on? or what? – Gerry Myerson Aug 30 '14 at 13:06
• @GerryMyerson its 123456789,12345678910,1234567891011... – Ogen Aug 30 '14 at 13:18
• @mathlove That problem is similar but there's a huge difference: Multi-digit numbers are not counted as one number for my problem, they are counted as separate numbers. Ie, the number $10$ just has $1$ then $0$ as digits in their own indexes – Ogen Aug 30 '14 at 13:50
• This may not help to answer the question, but if you put a decimal point in front, $$.123456789101112131415\dots,$$ you get what is known as Champernowne's number, about which there is much information on the web. – Gerry Myerson Aug 30 '14 at 22:55

The sequence $$1,2,3,4,5,6,7,8,9,1,0,1,1,1,2,1,3,1,4\dots$$ which is what the given sequence is "converging to" is listed at the Online Encyclopedia of Integer Sequences. A formula for the $n$th term, due to David Cantrell, is given there, but you'll have to look up the Lambert W-function to understand it.

Let "index" $i = ceiling( W(\log(10)/10^{1/9} (n - 1/9))/\log(10) + 1/9 )$ where $W$ denotes the principal branch of the Lambert $W$ function. Then $$a(n) = mod(floor(10^{mod(n + (10^i - 10)/9, i) - i + 1} ceiling((9n + 10^i - 1)/(9i) - 1)), 10)$$

Some of that is a bit confusing, but aside from doing a little bit of TeX formatting I have tried to copy it as it's given at the OEIS.

Not a complete answer to your question, but it reminds me of the factorial number system.

Under this mixed-radix system, the sequence $A_n=(n!-1)$ yields:

• $0$
• $10$
• $210$
• $3210$
• $43210$
• $543210$
• $\dots$
• @DanielR: You're right. I've essentially removed the answer, leaving some related information that might be useful for OP or for anyone else trying to write-down a proper solution. Thanks. – barak manos Aug 30 '14 at 13:15