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.

A278161 Run length transform of A008619 (floor(n/2)+1).

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 3, 3, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 4, 4, 2, 2, 2, 4, 3, 3, 3, 4, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 3, 3, 2, 2, 2, 4, 2, 2, 4, 4, 2, 2, 2, 4, 4, 4, 4, 6, 2, 2, 2, 4, 2, 2, 4, 4, 3
Offset: 0

Views

Author

Antti Karttunen, Nov 14 2016

Keywords

Examples

			n=111 is "1101111" in binary, which has two runs of 1-bits: the other has length 2, and the other has length 4, thus we take the product A008619(2)*A008619(4) = (floor(2/2)+1) * (floor(4/2)+1) = 2*3, which is the result, so a(111) = 6.
		

Crossrefs

Cf. A106737, A227349 for other run length transforms, and also A278222.

Programs

  • Mathematica
    f[n_] := Floor[n/2] + 1; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 120}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    def A278161(n): return sum(int(not (~(n+3*k) & 6*k) | (~n & k)) for k in range(n+1)) # Chai Wah Wu, Sep 28 2021
  • Scheme
    (define (A278161 n) (fold-left (lambda (a r) (* a (A008619 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (define (A008619 n) (+ 1 (/ (- n (modulo n 2)) 2)))
    ;; See A227349 for the required other functions.
    

Formula

a(n) = A046951(A005940(1+n)), a(A156552(n)) = A046951(n).
a(n) = Sum_{k=0..n} ((binomial(n+3k,6k)*binomial(n,k)) mod 2). - Chai Wah Wu, Nov 19 2019