Function Repository Resource:

Fibbinary

Source Notebook

Get the fibbinary sequence

Contributed by: Wolfram Staff, based on work by Jörg Arndt, Robert G. Wilson and Eric W. Weisstein

ResourceFunction["Fibbinary"][n]

gives the nth fibbinary number.

ResourceFunction["Fibbinary"][{n}]

gives a list of fibbinary numbers less than or equal to n.

Details

Fibbinary numbers are the positive integers whose binary representation contains no consecutive ones.

Examples

Basic Examples (3) 

First one hundred fibbinaries:

In[1]:=
Table[ResourceFunction["Fibbinary"][n], {n, 100}]
Out[1]=

Fibbinaries less than or equal to 50, represented in base 2:

In[2]:=
BaseForm[#, 2] & /@ ResourceFunction["Fibbinary"][{50}] // Column
Out[2]=

Plot of fibbinaries less than 150 in base 2:

In[3]:=
IntegerDigits[ResourceFunction["Fibbinary"][{150}], 2] // ArrayPlot
Out[3]=

Properties and Relations (2) 

Fibbinaries are related to the Zeckendorf representation:

In[4]:=
ResourceFunction["Fibbinary"][12]
Out[4]=
In[5]:=
IntegerDigits[ResourceFunction["Fibbinary"][12], 2]
Out[5]=
In[6]:=
ResourceFunction["ZeckendorfRepresentation"][12]
Out[6]=

Adding the following integers gives 12:

In[7]:=
Pick[Fibonacci[Range[2, 6]], {1, 0, 1, 0, 1}, 1]
Out[7]=
In[8]:=
Total[%]
Out[8]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 1.0.2 – 04 October 2021

Related Resources

License Information