OFFSET
0,4
COMMENTS
The Run Length Transform of a sequence {S(n), n>=0} is defined to be the sequence {T(n), n>=0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g. 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0)=1 (the empty product).
This sequence is obtained by applying Run Length Transform to sequence b = 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers, with b(1) = 1, b(2) = 3, b(3) = 5, ..., b(n) = 2^(2^(n-2)) + 1 for n >= 2).
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..1024
EXAMPLE
115 is '1110011' in binary. The run lengths of 1-runs are 2 and 3, thus we multiply the second and the third elements of the sequence 1, 3, 5, 17, 257, 65537, ... to get a(115) = 3*5 = 15.
MATHEMATICA
f[n_] := Switch[n, 0|1, 1, _, 2^(2^(n-2))+1]; Table[Times @@ (f[Length[#]] &) /@ Select[s = Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 95}] (* Jean-François Alcover, Jul 11 2017 *)
PROG
(MIT/GNU Scheme)
(define (A246685 n) (fold-left (lambda (a r) (if (= 1 r) a (* a (A000215 (- r 2))))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
(define (A000079 n) (expt 2 n))
;; Other functions as in A227349.
(Python)
# use RLT function from A278159
def A246685(n): return RLT(n, lambda m: 1 if m <= 1 else 2**(2**(m-2))+1) # Chai Wah Wu, Feb 04 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 22 2014
STATUS
approved