A246685 Run Length Transform of sequence 1, 3, 5, 17, 257, 65537, ... (1 followed by Fermat numbers).
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, 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, 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
Offset: 0
Keywords
Examples
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.
Links
- Antti Karttunen, Table of n, a(n) for n = 0..1024
Crossrefs
Programs
-
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 *)
-
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
Comments