Content deleted Content added
Lomination (talk | contribs) Improve decoding explainations |
|||
(One intermediate revision by one other user not shown) | |||
Line 5:
The following steps describe how to encode a nonzero integer <math> x </math>. Note that <math> f </math> denotes the Negafibonacci sequence.
# If <math> x </math> is positive, compute the greatest odd negative integer <math> n </math> such that the sum of the odd negative terms of the Negafibonacci sequence from
# Add a 1 at the <math> |n|^{\text{th}} </math> bit of the binary word. Subtract <math> f(n) </math> from <math> x </math>.
# Repeat the process from step 1 with the new value of ''x'', until it reaches 0.
# Add a 1 on the left of the resulting binary word to finish the encoding.
To decode an encoded binary word, remove the leftmost 1 from the binary word, since it is used only to denote the end of the encoded number. Then assign the remaining bits the values of the Negafibonacci sequence from
== Negafibonacci representation ==
Line 96:
[[Category:Lossless compression algorithms]]
[[Category:Fibonacci numbers]]
[[Category:Data compression]]
[[fr:Codage de Fibonacci]]
|