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).

This page as a plain text file.
%I A022340 #43 Apr 24 2025 17:31:35
%S A022340 0,2,4,8,10,16,18,20,32,34,36,40,42,64,66,68,72,74,80,82,84,128,130,
%T A022340 132,136,138,144,146,148,160,162,164,168,170,256,258,260,264,266,272,
%U A022340 274,276,288,290,292,296,298,320,322,324,328,330,336,338,340,512
%N A022340 Even Fibbinary numbers (A003714); also 2*Fibbinary(n).
%C A022340 Positions of ones in binomial(3k+2,k+1)/(3k+2) modulo 2 (A085405). - _Paul D. Hanna_, Jun 29 2003
%C A022340 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
%C A022340 From _Gus Wiseman_, Apr 08 2020: (Start)
%C A022340 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:
%C A022340     0: ()          80: (2,5)        260: (6,3)
%C A022340     2: (2)         82: (2,3,2)      264: (5,4)
%C A022340     4: (3)         84: (2,2,3)      266: (5,2,2)
%C A022340     8: (4)        128: (8)          272: (4,5)
%C A022340    10: (2,2)      130: (6,2)        274: (4,3,2)
%C A022340    16: (5)        132: (5,3)        276: (4,2,3)
%C A022340    18: (3,2)      136: (4,4)        288: (3,6)
%C A022340    20: (2,3)      138: (4,2,2)      290: (3,4,2)
%C A022340    32: (6)        144: (3,5)        292: (3,3,3)
%C A022340    34: (4,2)      146: (3,3,2)      296: (3,2,4)
%C A022340    36: (3,3)      148: (3,2,3)      298: (3,2,2,2)
%C A022340    40: (2,4)      160: (2,6)        320: (2,7)
%C A022340    42: (2,2,2)    162: (2,4,2)      322: (2,5,2)
%C A022340    64: (7)        164: (2,3,3)      324: (2,4,3)
%C A022340    66: (5,2)      168: (2,2,4)      328: (2,3,4)
%C A022340    68: (4,3)      170: (2,2,2,2)    330: (2,3,2,2)
%C A022340    72: (3,4)      256: (9)          336: (2,2,5)
%C A022340    74: (3,2,2)    258: (7,2)        338: (2,2,3,2)
%C A022340 (End)
%H A022340 Reinhard Zumkeller, <a href="/A022340/b022340.txt">Table of n, a(n) for n = 0..10000</a>
%F A022340 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.
%F A022340 a(n) + a(n)/2 = a(n) XOR a(n)/2, see A106409. - _Reinhard Zumkeller_, May 02 2005
%t A022340 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 *)
%t A022340 Select[Range[2, 512, 2], BitAnd[#, 2#] == 0 &] (* _Alonso del Arte_, Jun 18 2012 *)
%o A022340 (Haskell)
%o A022340 a022340 = (* 2) . a003714 -- _Reinhard Zumkeller_, Feb 03 2015
%o A022340 (Python)
%o A022340 from itertools import count, islice
%o A022340 def A022340_gen(startvalue=0): # generator of terms >= startvalue
%o A022340     return filter(lambda n:not n&(n>>1),count(max(0,startvalue+(startvalue&1)),2))
%o A022340 A022340_list = list(islice(A022340_gen(),30)) # _Chai Wah Wu_, Sep 07 2022
%o A022340 (Python)
%o A022340 def A022340(n):
%o A022340     tlist, s = [1,2], 0
%o A022340     while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
%o A022340     for d in tlist[::-1]:
%o A022340         if d <= n:
%o A022340             s += 1
%o A022340             n -= d
%o A022340         s <<= 1
%o A022340     return s # _Chai Wah Wu_, Apr 24 2025
%Y A022340 Equals 2 * A003714.
%Y A022340 Cf. A006013, A001045, A085405, A085407.
%Y A022340 Compositions with no ones are counted by A212804.
%Y A022340 All of the following pertain to compositions in standard order (A066099):
%Y A022340 - Length is A000120.
%Y A022340 - Compositions without terms > 2 are A003754.
%Y A022340 - Compositions without ones are A022340 (this sequence).
%Y A022340 - Sum is A070939.
%Y A022340 - Compositions with no twos are A175054.
%Y A022340 - Strict compositions are A233564.
%Y A022340 - Constant compositions are A272919.
%Y A022340 - Normal compositions are A333217.
%Y A022340 - Runs-resistance is A333628.
%Y A022340 Cf. A066099, A124767, A228351, A318928, A333218.
%K A022340 nonn
%O A022340 0,2
%A A022340 _Marc LeBrun_
%E A022340 Edited by _Ralf Stephan_, Sep 01 2004