login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A286575 Run-length transform of A001316. 5

%I #20 Feb 04 2022 14:36:57

%S 1,2,2,2,2,4,2,4,2,4,4,4,2,4,4,2,2,4,4,4,4,8,4,8,2,4,4,4,4,8,2,4,2,4,

%T 4,4,4,8,4,8,4,8,8,8,4,8,8,4,2,4,4,4,4,8,4,8,4,8,8,8,2,4,4,4,2,4,4,4,

%U 4,8,4,8,4,8,8,8,4,8,8,4,4,8,8,8,8,16,8,16,4,8,8,8,8,16,4,8,2,4,4,4,4,8,4,8,4,8,8,8,4

%N Run-length transform of A001316.

%H Antti Karttunen, <a href="/A286575/b286575.txt">Table of n, a(n) for n = 0..16384</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Ru#rlt">Index entries for sequences computed with run length transform</a>

%F a(n) = A037445(A005940(1+n)).

%F a(n) = A000079(A286574(n)).

%e For n = 0, there are no 1-runs, and thus a(0) = 1 as an empty product.

%e For n = 29, "11101" in binary, there are two 1-runs, of lengths 1 and 3, thus a(29) = A001316(1) * A001316(3) = 2*4 = 8.

%t Table[Times @@ Map[Sum[Mod[#, 2] &@ Binomial[#, k], {k, 0, #}] &@ Length@ # &, DeleteCases[Split@ IntegerDigits[n, 2], _?(First@ # == 0 &)]], {n, 0, 108}] (* _Michael De Vlieger_, May 29 2017 *)

%o (Scheme)

%o (define (A286575 n) (fold-left (lambda (a r) (* a (A001316 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))

%o (define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z)))))

%o (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))

%o (define (A001316 n) (let loop ((n n) (z 1)) (cond ((zero? n) z) ((even? n) (loop (/ n 2) z)) (else (loop (/ (- n 1) 2) (* z 2))))))

%o (Python)

%o from sympy import factorint, prime, log

%o import math

%o def wt(n): return bin(n).count("1")

%o def a037445(n):

%o f=factorint(n)

%o return 2**sum([wt(f[i]) for i in f])

%o def A(n): return n - 2**int(math.floor(log(n, 2)))

%o 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 def a(n): return a037445(b(n)) # _Indranil Ghosh_, May 30 2017

%o (Python)

%o # use RLT function from A278159

%o def A286575(n): return RLT(n,lambda m: 2**(bin(m).count('1'))) # _Chai Wah Wu_, Feb 04 2022

%Y Cf. A000079, A001316, A005940, A037445, A227349, A247282, A286574.

%K nonn,base

%O 0,2

%A _Antti Karttunen_, May 28 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 14:32 EDT 2024. Contains 371960 sequences. (Running on oeis4.)