login
A071762
Leftmost 1 is converted to a 2, which then propagates one step at a time until it is rightmost; then it changes to a pair of 1's and the process repeats.
3
0, 1, 2, 11, 21, 12, 111, 211, 121, 112, 1111, 2111, 1211, 1121, 1112, 11111, 21111, 12111, 11211, 11121, 11112, 111111, 211111, 121111, 112111, 111211, 111121, 111112, 1111111, 2111111, 1211111, 1121111, 1112111, 1111211, 1111121, 1111112, 11111111, 21111111
OFFSET
0,3
COMMENTS
Arises in analysis of Bulgarian solitaire.
From J.N. Cressey, Apr 24 2026: (Start)
To construct a(n) for n > 0: repeat the digit 1 A003056(n) times. Let r = A002262(n). If r > 0, replace the digit at position r, 1-indexed from the left, with the digit 2.
The run lengths of 1's from either end in the decimal representation are given by: A128138(n) from the left end, for n >= 1; and A025581(n) from the right end. (End)
LINKS
FORMULA
a(n) = A002275(A003056(n)) + (1-A010054(n))*10^A025581(n). - J.N. Cressey, Apr 19 2026
MATHEMATICA
f1[{a_, b_}]:={a, NestList[FromDigits[RotateRight[IntegerDigits[#]]]&, b, IntegerLength[ b]-1]}; Join[{0}, f1/@Table[{FromDigits[PadRight[{}, n, 1]], FromDigits[ PadRight[{2}, n, 1]]}, {n, 7}]//Flatten] (* Harvey P. Dale, May 15 2018 *)
PROG
(Python)
from math import comb, isqrt
def a(n):
L, i = (isqrt(1+8*n)-1)//2, n-comb((1+isqrt(8+8*n))//2, 2) # A003056(n), A002262(n)
return 10**L//9 + int(i > 0)*10**(L-i)
print([a(n) for n in range(38)]) # Michael S. Branicky, Apr 24 2026
KEYWORD
nonn,easy
AUTHOR
Allan C. Wechsler, Jun 07 2002
EXTENSIONS
More terms from Sascha Kurz, Jan 28 2003
STATUS
approved