[go: up one dir, main page]

login
A371032
a(n) is the integer whose decimal digits are 0's or 1's in alternating runs of lengths n, n-1, n-2, ..., 3, 2, 1.
3
1, 110, 111001, 1111000110, 111110000111001, 111111000001111000110, 1111111000000111110000111001, 111111110000000111111000001111000110, 111111111000000001111111000000111110000111001, 1111111111000000000111111110000000111111000001111000110
OFFSET
1,2
FORMULA
a(n) = A007088(A371033(n)). - Michel Marcus, Jul 09 2024
a(n) = (10^(n*(n+1)/2) - 1)/9 - a(n-1). - Robert Israel, Jul 09 2024
EXAMPLE
a(1) = 1 has runlength 1; a(2) = 110 has runlengths 2,1; a(3) = 111001 has runlengths 3,2,1.
MAPLE
f:= proc(n) option remember; (10^(n*(n+1)/2)-1)/9 - procname(n-1) end proc:
f(1):= 1:
map(f, [$1..30]); # Robert Israel, Jul 09 2024
MATHEMATICA
Flatten[Table[Flatten[Map[ConstantArray[Mod[#, 2], n + 1 - #] &, Range[n]]], {n, 10}]] (* Peter J. C. Moses, Mar 08 2024 *)
PROG
(Python)
def A371032(n):
c = 0
for i in range(n):
c = (m:=10**(n-i))*c
if i&1^1:
c += (m-1)//9
return c # Chai Wah Wu, Mar 18 2024
CROSSREFS
Cf. A000217 (binary lengths), A007088, A065447, A371033 (decimal version).
Sequence in context: A329338 A203718 A143750 * A192844 A234512 A343181
KEYWORD
nonn,base,easy
AUTHOR
Clark Kimberling, Mar 09 2024
EXTENSIONS
New name from Michel Marcus, Jul 09 2024
STATUS
approved