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.

A246685 Run Length Transform of sequence 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers).

This page as a plain text file.
%I A246685 #20 Feb 04 2022 14:36:43
%S A246685 1,1,1,3,1,1,3,5,1,1,1,3,3,3,5,17,1,1,1,3,1,1,3,5,3,3,3,9,5,5,17,257,
%T A246685 1,1,1,3,1,1,3,5,1,1,1,3,3,3,5,17,3,3,3,9,3,3,9,15,5,5,5,15,17,17,257,
%U A246685 65537,1,1,1,3,1,1,3,5,1,1,1,3,3,3,5,17,1,1,1,3,1,1,3,5,3,3,3,9,5,5,17,257
%N A246685 Run Length Transform of sequence 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers).
%C A246685 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).
%C A246685 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).
%H A246685 Antti Karttunen, <a href="/A246685/b246685.txt">Table of n, a(n) for n = 0..1024</a>
%e A246685 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.
%t A246685 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 *)
%o A246685 (MIT/GNU Scheme)
%o A246685 (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)))))
%o A246685 (define (A000215 n) (+ 1 (A000079 (A000079 n))))
%o A246685 (define (A000079 n) (expt 2 n))
%o A246685 ;; Other functions as in A227349.
%o A246685 (Python)
%o A246685 # use RLT function from A278159
%o A246685 def A246685(n): return RLT(n,lambda m: 1 if m <= 1 else 2**(2**(m-2))+1) # _Chai Wah Wu_, Feb 04 2022
%Y A246685 Cf. A003714 (gives the positions of ones).
%Y A246685 Cf. A000215.
%Y A246685 A001316 is obtained when the same transformation is applied to A000079, the powers of two. Cf. also A001317.
%Y A246685 Run Length Transforms of other sequences: A071053, A227349, A246588, A246595, A246596, A246660, A246661, A246674, A247282.
%K A246685 nonn
%O A246685 0,4
%A A246685 _Antti Karttunen_, Sep 22 2014