A286298 a(0) = 0, a(1) = 1; thereafter, a(2n) = a(n) + 1 + (n mod 2), a(2n+1) = a(n) + 2 - (n mod 2).
0, 1, 3, 2, 4, 5, 4, 3, 5, 6, 7, 6, 5, 6, 5, 4, 6, 7, 8, 7, 8, 9, 8, 7, 6, 7, 8, 7, 6, 7, 6, 5, 7, 8, 9, 8, 9, 10, 9, 8, 9, 10, 11, 10, 9, 10, 9, 8, 7, 8, 9, 8, 9, 10, 9, 8, 7, 8, 9, 8, 7, 8, 7, 6, 8, 9, 10, 9, 10, 11, 10, 9, 10, 11, 12, 11, 10, 11, 10, 9, 10, 11, 12, 11, 12, 13, 12, 11, 10, 11, 12
Offset: 0
Examples
For k = -5, n = 10 and f(10) = 7, so -5 first appears in G(7). - _Karyn McLellan_, Aug 16 2018
References
- C. Kimberling, Problem proposals, Proceedings of the Sixteenth International Conference on Fibonacci Numbers and Their Applications, P. Anderson, C. Ballot and W. Webb, eds. The Fibonacci Quarterly, 52.5(2014), 5-14.
Links
- Chai Wah Wu, Table of n, a(n) for n = 0..10000
- Danielle Cox and K. McLellan, A problem on generation sets containing Fibonacci numbers, Fib. Quart., 55 (No. 2, 2017), 105-113.
Programs
-
Maple
f:=proc(n) option remember; if n <= 1 then n elif (n mod 2) = 0 then f(n/2)+1+((n/2) mod 2); else f((n-1)/2) + 2 - ((n-1)/2 mod 2); end if; end proc; [seq(f(n),n=0..120)];
-
PARI
a(n) = if (n==0, 0, logint(n, 2) + hammingweight(bitxor(n, n>>1))); \\ Michel Marcus, Aug 21 2018
-
Python
def A286298(n): if n <= 1: return n a, b = divmod(n, 2) return A286298(a) + 1 + b + (-1)**b*(a % 2) # Chai Wah Wu, Jun 02 2017
Comments