<s>
In	O
mathematics	O
and	O
computing	O
,	O
Fibonacci	B-Algorithm
coding	I-Algorithm
is	O
a	O
universal	B-Algorithm
code	I-Algorithm
which	O
encodes	O
positive	O
integers	O
into	O
binary	O
code	O
words	O
.	O
</s>
<s>
It	O
is	O
one	O
example	O
of	O
representations	O
of	O
integers	O
based	O
on	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
.	O
</s>
<s>
The	O
Fibonacci	B-Algorithm
code	I-Algorithm
is	O
closely	O
related	O
to	O
the	O
Zeckendorf	B-Algorithm
representation	I-Algorithm
,	O
a	O
positional	O
numeral	O
system	O
that	O
uses	O
Zeckendorf	B-Algorithm
's	I-Algorithm
theorem	I-Algorithm
and	O
has	O
the	O
property	O
that	O
no	O
number	O
has	O
a	O
representation	O
with	O
consecutive	O
1s	O
.	O
</s>
<s>
The	O
Fibonacci	B-Algorithm
code	I-Algorithm
word	O
for	O
a	O
particular	O
integer	O
is	O
exactly	O
the	O
integer	O
's	O
Zeckendorf	B-Algorithm
representation	I-Algorithm
with	O
the	O
order	O
of	O
its	O
digits	O
reversed	O
and	O
an	O
additional	O
"	O
1	O
"	O
appended	O
to	O
the	O
end	O
.	O
</s>
<s>
where	O
is	O
the	O
th	O
Fibonacci	B-Algorithm
number	I-Algorithm
,	O
and	O
so	O
is	O
the	O
th	O
distinct	O
Fibonacci	B-Algorithm
number	I-Algorithm
starting	O
with	O
.	O
</s>
<s>
The	O
first	O
few	O
Fibonacci	B-Algorithm
codes	I-Algorithm
are	O
shown	O
below	O
,	O
and	O
also	O
their	O
so-called	O
implied	O
probability	O
,	O
the	O
value	O
for	O
each	O
number	O
that	O
has	O
a	O
minimum-size	O
code	O
in	O
Fibonacci	B-Algorithm
coding	I-Algorithm
.	O
</s>
<s>
Find	O
the	O
largest	O
Fibonacci	B-Algorithm
number	I-Algorithm
equal	O
to	O
or	O
less	O
than	O
N	O
;	O
subtract	O
this	O
number	O
from	O
N	O
,	O
keeping	O
track	O
of	O
the	O
remainder	O
.	O
</s>
<s>
If	O
the	O
number	O
subtracted	O
was	O
the	O
ith	O
Fibonacci	B-Algorithm
number	I-Algorithm
F(i )	O
,	O
put	O
a	O
1	O
in	O
place	O
i2	O
in	O
the	O
code	O
word	O
(	O
counting	O
the	O
left	O
most	O
digit	O
as	O
place	O
0	O
)	O
.	O
</s>
<s>
To	O
decode	O
a	O
code	O
word	O
,	O
remove	O
the	O
final	O
"	O
1	O
"	O
,	O
assign	O
the	O
remaining	O
the	O
values	O
1	O
,	O
2	O
,	O
3	O
,	O
5	O
,	O
8	O
,	O
13	O
...	O
(	O
the	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
)	O
to	O
the	O
bits	O
in	O
the	O
code	O
word	O
,	O
and	O
sum	O
the	O
values	O
of	O
the	O
"	O
1	O
"	O
bits	O
.	O
</s>
<s>
Fibonacci	B-Algorithm
coding	I-Algorithm
has	O
a	O
useful	O
property	O
that	O
sometimes	O
makes	O
it	O
attractive	O
in	O
comparison	O
to	O
other	O
universal	B-Algorithm
codes	I-Algorithm
:	O
it	O
is	O
an	O
example	O
of	O
a	O
self-synchronizing	O
code	O
,	O
making	O
it	O
easier	O
to	O
recover	O
data	O
from	O
a	O
damaged	O
stream	O
.	O
</s>
<s>
With	O
most	O
other	O
universal	B-Algorithm
codes	I-Algorithm
,	O
if	O
a	O
single	O
bit	O
is	O
altered	O
,	O
none	O
of	O
the	O
data	O
that	O
comes	O
after	O
it	O
will	O
be	O
correctly	O
read	O
.	O
</s>
<s>
With	O
Fibonacci	B-Algorithm
coding	I-Algorithm
,	O
on	O
the	O
other	O
hand	O
,	O
a	O
changed	O
bit	O
may	O
cause	O
one	O
token	O
to	O
be	O
read	O
as	O
two	O
,	O
or	O
cause	O
two	O
tokens	O
to	O
be	O
read	O
incorrectly	O
as	O
one	O
,	O
but	O
reading	O
a	O
"	O
0	O
"	O
from	O
the	O
stream	O
will	O
stop	O
the	O
errors	O
from	O
propagating	O
further	O
.	O
</s>
<s>
The	O
following	O
table	O
shows	O
that	O
the	O
number	O
65	O
is	O
represented	O
in	O
Fibonacci	B-Algorithm
coding	I-Algorithm
as	O
0100100011	O
,	O
since	O
.	O
</s>
<s>
The	O
first	O
two	O
Fibonacci	B-Algorithm
numbers	I-Algorithm
(	O
0	O
and	O
1	O
)	O
are	O
not	O
used	O
,	O
and	O
an	O
additional	O
1	O
is	O
always	O
appended	O
.	O
</s>
<s>
The	O
Fibonacci	B-Algorithm
encodings	I-Algorithm
for	O
the	O
positive	O
integers	O
are	O
binary	O
strings	O
that	O
end	O
with	O
"	O
11	O
"	O
and	O
contain	O
no	O
other	O
instances	O
of	O
"	O
11	O
"	O
.	O
</s>
<s>
For	O
general	O
constraints	O
defining	O
which	O
symbols	O
are	O
allowed	O
after	O
a	O
given	O
symbol	O
,	O
the	O
maximal	O
information	O
rate	O
can	O
be	O
obtained	O
by	O
first	O
finding	O
the	O
optimal	O
transition	O
probabilities	O
using	O
maximal	O
entropy	O
random	O
walk	O
,	O
then	O
use	O
entropy	B-Algorithm
coder	I-Algorithm
(	O
with	O
switched	O
encoder	O
with	O
decoder	O
)	O
to	O
encode	O
a	O
message	O
as	O
a	O
sequence	O
of	O
symbols	O
fulfilling	O
the	O
found	O
optimal	O
transition	O
probabilities	O
.	O
</s>
