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.

Original entry on oeis.org

1, 110, 111001, 1111000110, 111110000111001, 111111000001111000110, 1111111000000111110000111001, 111111110000000111111000001111000110, 111111111000000001111111000000111110000111001, 1111111111000000000111111110000000111111000001111000110
Offset: 1

Views

Author

Clark Kimberling, Mar 09 2024

Keywords

Examples

			a(1) = 1 has runlength 1; a(2) = 110 has runlengths 2,1; a(3) = 111001 has runlengths 3,2,1.
		

Crossrefs

Cf. A000217 (binary lengths), A007088, A065447, A371033 (decimal version).

Programs

  • 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 *)
  • 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

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

Extensions

New name from Michel Marcus, Jul 09 2024