A022340 Even Fibbinary numbers (A003714); also 2*Fibbinary(n).
0, 2, 4, 8, 10, 16, 18, 20, 32, 34, 36, 40, 42, 64, 66, 68, 72, 74, 80, 82, 84, 128, 130, 132, 136, 138, 144, 146, 148, 160, 162, 164, 168, 170, 256, 258, 260, 264, 266, 272, 274, 276, 288, 290, 292, 296, 298, 320, 322, 324, 328, 330, 336, 338, 340, 512
Offset: 0
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Crossrefs
Equals 2 * A003714.
Compositions with no ones are counted by A212804.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Compositions without terms > 2 are A003754.
- Compositions without ones are A022340 (this sequence).
- Sum is A070939.
- Compositions with no twos are A175054.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Normal compositions are A333217.
- Runs-resistance is A333628.
Programs
-
Haskell
a022340 = (* 2) . a003714 -- Reinhard Zumkeller, Feb 03 2015
-
Mathematica
f[n_Integer] := Block[{k = Ceiling[ Log[ GoldenRatio, n*Sqrt[5]]], t = n, fr = {}}, While[k > 1, If[t >= Fibonacci[k], AppendTo[fr, 1]; t = t - Fibonacci[k], AppendTo[fr, 0]]; k-- ]; FromDigits[fr, 2]]; Select[f /@ Range[0, 95], EvenQ[ # ] &] (* Robert G. Wilson v, Sep 18 2004 *) Select[Range[2, 512, 2], BitAnd[#, 2#] == 0 &] (* Alonso del Arte, Jun 18 2012 *)
-
Python
from itertools import count, islice def A022340_gen(startvalue=0): # generator of terms >= startvalue return filter(lambda n:not n&(n>>1),count(max(0,startvalue+(startvalue&1)),2)) A022340_list = list(islice(A022340_gen(),30)) # Chai Wah Wu, Sep 07 2022
-
Python
def A022340(n): tlist, s = [1,2], 0 while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2]) for d in tlist[::-1]: if d <= n: s += 1 n -= d s <<= 1 return s # Chai Wah Wu, Apr 24 2025
Formula
For n>0, a(F(n))=2^n, a(F(n)-1)=A001045(n+2)-1, where F(n) is the n-th Fibonacci number with F(0)=F(1)=1.
a(n) + a(n)/2 = a(n) XOR a(n)/2, see A106409. - Reinhard Zumkeller, May 02 2005
Extensions
Edited by Ralf Stephan, Sep 01 2004
Comments