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.

A022340 Even Fibbinary numbers (A003714); also 2*Fibbinary(n).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Positions of ones in binomial(3k+2,k+1)/(3k+2) modulo 2 (A085405). - Paul D. Hanna, Jun 29 2003
Construction: start with strings S(0)={0}, S(1)={2}; for k>=2, concatenate all prior strings excluding S(k-1) and add 2^k to each element in the resulting string to obtain S(k); this sequence is the concatenation of all such generated strings: {S(0),S(1),S(2),...}. Example: for k=5, concatenate {S(0),S(1),S(2),S(3)} = {0, 2, 4, 8,10}; add 2^5 to each element to obtain S(5)={32,34,38,40,42}. - Paul D. Hanna, Jun 29 2003
From Gus Wiseman, Apr 08 2020: (Start)
The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions. This sequence lists all numbers k such that the k-th composition in standard order has no ones. For example, the sequence together with the corresponding compositions begins:
0: () 80: (2,5) 260: (6,3)
2: (2) 82: (2,3,2) 264: (5,4)
4: (3) 84: (2,2,3) 266: (5,2,2)
8: (4) 128: (8) 272: (4,5)
10: (2,2) 130: (6,2) 274: (4,3,2)
16: (5) 132: (5,3) 276: (4,2,3)
18: (3,2) 136: (4,4) 288: (3,6)
20: (2,3) 138: (4,2,2) 290: (3,4,2)
32: (6) 144: (3,5) 292: (3,3,3)
34: (4,2) 146: (3,3,2) 296: (3,2,4)
36: (3,3) 148: (3,2,3) 298: (3,2,2,2)
40: (2,4) 160: (2,6) 320: (2,7)
42: (2,2,2) 162: (2,4,2) 322: (2,5,2)
64: (7) 164: (2,3,3) 324: (2,4,3)
66: (5,2) 168: (2,2,4) 328: (2,3,4)
68: (4,3) 170: (2,2,2,2) 330: (2,3,2,2)
72: (3,4) 256: (9) 336: (2,2,5)
74: (3,2,2) 258: (7,2) 338: (2,2,3,2)
(End)

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