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.

A286574 Sum of the binary weights of the lengths of 1-runs in base-2 representation of n: a(n) = A000523(A286575(n)).

This page as a plain text file.
%I A286574 #22 Feb 04 2022 14:36:50
%S A286574 0,1,1,1,1,2,1,2,1,2,2,2,1,2,2,1,1,2,2,2,2,3,2,3,1,2,2,2,2,3,1,2,1,2,
%T A286574 2,2,2,3,2,3,2,3,3,3,2,3,3,2,1,2,2,2,2,3,2,3,2,3,3,3,1,2,2,2,1,2,2,2,
%U A286574 2,3,2,3,2,3,3,3,2,3,3,2,2,3,3,3,3,4,3,4,2,3,3,3,3,4,2,3,1,2,2,2,2,3,2,3,2,3,3,3,2,3,3,2,2,3,3,3,3,4,3,4,1
%N A286574 Sum of the binary weights of the lengths of 1-runs in base-2 representation of n: a(n) = A000523(A286575(n)).
%C A286574 a(0) = 0 (an empty sum).
%H A286574 Antti Karttunen, <a href="/A286574/b286574.txt">Table of n, a(n) for n = 0..65536</a>
%H A286574 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A286574 a(n) = A000523(A286575(n)). [Log_2 of run-length transform of A001316.]
%F A286574 a(n) = A064547(A005940(1+n)).
%e A286574 For n = 27, "11011" in binary, there are two 1-runs, both of length 2, thus a(27) = A000120(2) + A000120(2) = 1 + 1 = 2.
%e A286574 For n = 29, "11101" in binary, there are two 1-runs, of lengths 1 and 3, thus a(29) = A000120(1) + A000120(3) = 1 + 2 = 3.
%e A286574 For n = 61, "111101" in binary, there are two 1-runs, of lengths 1 and 4, thus a(61) = A000120(1) + A000120(4) = 1 + 1 = 2.
%o A286574 (Scheme) (define (A286574 n) (A000523 (A286575 n)))
%o A286574 (Python)
%o A286574 from sympy import factorint, prime, log
%o A286574 import math
%o A286574 def wt(n): return bin(n).count("1")
%o A286574 def a037445(n):
%o A286574     f=factorint(n)
%o A286574     return 2**sum([wt(f[i]) for i in f])
%o A286574 def A(n): return n - 2**int(math.floor(log(n, 2)))
%o A286574 def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
%o A286574 def a286575(n): return a037445(b(n))
%o A286574 def a(n): return int(math.floor(log(a286575(n), 2))) # _Indranil Ghosh_, May 30 2017
%o A286574 (Python)
%o A286574 # uses RLT function from A278159
%o A286574 def A286574(n): return len(bin(RLT(n,lambda m: 2**(bin(m).count('1')))))-3 # _Chai Wah Wu_, Feb 04 2022
%Y A286574 Cf. A000120, A000523, A001316, A005940, A064547, A286575.
%K A286574 nonn,base
%O A286574 0,6
%A A286574 _Antti Karttunen_, May 28 2017