A356874 Write n as Sum_{i in S} 2^(i-1), where S is a set of positive integers, then a(n) = Sum_{i in S} F_i, where F_i is the i-th Fibonacci number, A000045(i).
0, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7, 7, 8, 8, 9, 8, 9, 9, 10, 10, 11, 11, 12, 8, 9, 9, 10, 10, 11, 11, 12, 11, 12, 12, 13, 13, 14, 14, 15, 13, 14, 14, 15, 15, 16, 16, 17, 16, 17, 17, 18, 18, 19, 19, 20, 13, 14, 14, 15, 15, 16, 16, 17, 16, 17, 17, 18, 18, 19, 19, 20
Offset: 0
Examples
n = 13: 13 = 8 + 4 + 1 = 2^(4-1) + 2^(3-1) + 2^(1-1); so a(n) = F_4 + F_3 + F_1 = 3 + 2 + 1 = 6. Table showing initial terms with Fibonacci subsets: n Fibonacci subset a(n) 0 { } (empty set) -> 0 = 0 1 { F_1 } -> 1 = 1 2 { F_2 } -> 0 + 1 = 1 3 { F_1, F_2 } -> 1 + 1 = 2 4 { F_3 } -> 0 + 0 + 2 = 2 5 { F_1, F_3 } -> 1 + 0 + 2 = 3 6 { F_2, F_3 } -> 0 + 1 + 2 = 3 7 { F_1, F_2, F_3 } -> 1 + 1 + 2 = 4 8 { F_4 } -> 0 + 0 + 0 + 3 = 3 9 { F_1, F_4 } -> 1 + 0 + 0 + 3 = 4
Links
- Amiram Eldar, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
a[n_] := Module[{d = IntegerDigits[n, 2], nd}, nd = Length[d]; Total[d * Fibonacci[Range[nd, 1, -1]]]]; Array[a, 100, 0] (* Amiram Eldar, Aug 08 2023 *)
-
PARI
a(n) = if(n==0,0,if(n%2==1,a(n-1)+1,a(n/2)+a(n\4))); \\ Peter Munn, Sep 06 2022
Comments