Wolfram Research

Function Repository Resource:

Fibbinary

Source Notebook

Get the fibbinary sequence

Contributed by: Wolfram staff, based on work by Robert G. Wilson, Eric W. Weisstein

ResourceFunction["Fibbinary"][n]

gives the nth fibbinary number.

ResourceFunction["Fibbinary"][{n}]

gives the fibbinary numbers until n.

Details and Options

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

Examples

Basic Examples

First 100 fibbinaries:

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

Fibbinaries until 50 in base 2:

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

Plot of fibbinaries until 150 in base 2:

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

Properties and Relations

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[5]=

Adding the following integers gives 12:

In[7]:=
Pick[Rest@Table[Fibonacci[n], {n, 6}], {1, 0, 1, 0, 1}, 1]
Out[7]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

See Also

License Information