cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A371032 #37 Jul 09 2024 16:20:29
%S A371032 1,110,111001,1111000110,111110000111001,111111000001111000110,
%T A371032 1111111000000111110000111001,111111110000000111111000001111000110,
%U A371032 111111111000000001111111000000111110000111001,1111111111000000000111111110000000111111000001111000110
%N 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.
%F A371032 a(n) = A007088(A371033(n)). - _Michel Marcus_, Jul 09 2024
%F A371032 a(n) = (10^(n*(n+1)/2) - 1)/9 - a(n-1). - _Robert Israel_, Jul 09 2024
%e A371032 a(1) = 1 has runlength 1; a(2) = 110 has runlengths 2,1; a(3) = 111001 has runlengths 3,2,1.
%p A371032 f:= proc(n) option remember; (10^(n*(n+1)/2)-1)/9 - procname(n-1) end proc:
%p A371032 f(1):= 1:
%p A371032 map(f, [$1..30]); # _Robert Israel_, Jul 09 2024
%t A371032 Flatten[Table[Flatten[Map[ConstantArray[Mod[#, 2], n + 1 - #] &, Range[n]]], {n, 10}]]   (* _Peter J. C. Moses_, Mar 08 2024 *)
%o A371032 (Python)
%o A371032 def A371032(n):
%o A371032     c = 0
%o A371032     for i in range(n):
%o A371032         c = (m:=10**(n-i))*c
%o A371032         if i&1^1:
%o A371032             c += (m-1)//9
%o A371032     return c # _Chai Wah Wu_, Mar 18 2024
%Y A371032 Cf. A000217 (binary lengths), A007088, A065447, A371033 (decimal version).
%K A371032 nonn,base,easy
%O A371032 1,2
%A A371032 _Clark Kimberling_, Mar 09 2024
%E A371032 New name from _Michel Marcus_, Jul 09 2024