Representing numbers as sums of fibonacci numbers

  • Thread starter Thread starter kaalen
  • Start date Start date
  • Tags Tags
    Numbers Sums
Click For Summary

Discussion Overview

The discussion revolves around representing numbers as sums of Fibonacci numbers, specifically focusing on how to increment such representations in a manner similar to binary counting. Participants explore the implications of this representation, including the uniqueness of the sums and the algorithmic approach to incrementing the Fibonacci counter.

Discussion Character

  • Homework-related
  • Exploratory
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their homework task of representing numbers as sums of Fibonacci numbers and seeks an algorithm for incrementing these representations.
  • Another participant questions whether the task involves writing an arbitrary number as a linear combination of Fibonacci numbers.
  • Some participants note that the representation is not unique due to the Fibonacci sequence's recursive nature, allowing for multiple valid representations of the same number.
  • There is a discussion about the counting pattern in Fibonacci representations, with examples provided for numbers 1 through 9, highlighting potential errors in the counting process.
  • Participants discuss the rules for incrementing the Fibonacci representation, including how to handle carries when the last two digits are both 1.
  • One participant expresses confusion about the incrementing process and the resulting values, indicating a struggle to follow the established rules.
  • Another participant reflects on the representation of Fibonacci numbers and suggests that different interpretations of the digits can lead to alternative representations of the same number.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct method for incrementing Fibonacci representations, and there are multiple competing views regarding the uniqueness of these representations and the counting process.

Contextual Notes

Participants express uncertainty about the rules for incrementing Fibonacci representations, particularly in handling carries and the implications of non-unique representations. There is also a lack of clarity on how to consistently apply the incrementing algorithm.

kaalen
Messages
20
Reaction score
0
I have the following homework to do. Apologies if it seems very easy - I just had a knee surgery and I think I can't really think straight due to pain medication, I feel so fuzzy and sleepy and my damn knee still hurts like $#%&.

So instead of representing numbers in a binary way I need to represent them as sums of fibonacci numbers where i-th number indicates whether that fibonacci number is part of the sum.
For example string 101110 represents the number f6+f4+f3+f3+f2 = 14.
What I need to do is come up with an algorithm to increment such fibonacci counter.

I found these solutions on the internet http://lcbb.epfl.ch/algs10/ex2-sol.pdf but I'm not even able to wrap my head around that at the moment.

If I go baby steps and count from 0 upwards
853211 (these are just fib. numbers to help with my short attention span)

0 000000
1 000001
2 000011 - last two flits are 01, we change them to 11
3 000101 - change last two to 01 and report carry 1
4 000111 - last two flits are 01, simply change to 11
5 001001 - last two flits are 11, change to 01, carry 1 to the 3rd position and then one more forward cause the 3rd one is 1

The result is 4 instead of 5 so I messed it up somewhere.
 
Technology news on Phys.org
kaalen said:
I have the following homework to do. Apologies if it seems very easy - I just had a knee surgery and I think I can't really think straight due to pain medication, I feel so fuzzy and sleepy and my damn knee still hurts like $#%&.

So instead of representing numbers in a binary way I need to represent them as sums of fibonacci numbers where i-th number indicates whether that fibonacci number is part of the sum.
For example string 101110 represents the number f6+f4+f3+f3+f2 = 14.
What I need to do is come up with an algorithm to increment such fibonacci counter.

I found these solutions on the internet http://lcbb.epfl.ch/algs10/ex2-sol.pdf but I'm not even able to wrap my head around that at the moment.

If I go baby steps and count from 0 upwards
853211 (these are just fib. numbers to help with my short attention span)

0 000000
1 000001
2 000011 - last two flits are 01, we change them to 11
3 000101 - change last two to 01 and report carry 1
4 000111 - last two flits are 01, simply change to 11
5 001001 - last two flits are 11, change to 01, carry 1 to the 3rd position and then one more forward cause the 3rd one is 1

The result is 4 instead of 5 so I messed it up somewhere.

Hey kaalen and welcome to the forums.

Just to clarify are you trying to represent an arbitrary number in a base system that has every base corresponding to the specific fibonnaci number?

In other words you take any number N and and you write it as a linear combination of other fibonacci numbers?
 
Since by defnition F_{n+1} = F_n + F_{n-1} your "pseudo-binary" representaton is not unique. For example 5 could be 1x5 + 0x3 + 0x2 + 0x1 or
0x5 + 1x3 + 1x2 + 0x1

The consequece is, you can "carry forwards" using the previous TWO digits, not just one. In other words you can replace ...011... by ...100... anywhere without changing the value of the "number".

If you do that, you can see a pattern developing in the two lowest-order digits as you count:

1 = 00001
2 = 00010
3 = 00011 = 00100
4 = 00101
5 = 00110 = 01000
6 = 01001
7 = 01010
8 = 01011 = 01100 = 10000
9 = 10001
etc
 
AlephZero said:
If you do that, you can see a pattern developing in the two lowest-order digits as you count:

1 = 00001
2 = 00010
3 = 00011 = 00100
4 = 00101
5 = 00110 = 01000
6 = 01001
7 = 01010
8 = 01011 = 01100 = 10000
9 = 10001
etc

Hmm, this is wrong
1 = 00001
2 = 00010 --> that's still 1
3 = 00011 = 00100 --> that's not 3, it's 2
4 = 00101 --> that's 3
5 = 00110 = 01000 --> that's 3
6 = 01001 --> that's 4
etc

If you look at the above instructions (in pdf), they say the following
If the last fit is a 0, we change it into a 1 and we are done. If
the last fit is a 1, we consider the previous fit as well. If the previous (penulti-mate) fit is a 0—that is, the last two fits in our fitstring are 01—we simply turn
it into a 1, so that now the last two fits are 11. (This works because the last two
positions both correspond to a value of 1.) On the other hand, if the previous
fit is also a 1, so that our fitstring ends with 11, we replace the last two fits by
01, and report a carry to the previous position—what we have done is to convert
x11 = x00 +011 = x00 +100 = (x +1)00 and then added 1 to obtain (x +1)01.
In the general case, then, we are at position i and have a carry. If the fit at po-sition i is a 0, we simply replace it by a 1 and are done. If, however, the fit is a
1, we now have 2Fi to set up in the fitstring and this is not a Fibonacci number.
But 2Fi = Fi+1 + Fi− 2, so we can propagate this carry upward and downward,
replacing the fit at position i by a 0. Now, notice that upward propagation always
follows the pattern (x +1)0: the fit to the right of the carry position is always a 0.
I get lost where the bolded text starts.

This is how I counted so far
0 000000
1 000001
2 000011 - last two flits are 01, we change them to 11
3 000101 - change last two to 01 and report carry 1
4 000111 - last two flits are 01, simply change to 11
Then for 5 I have the following three options (like you said representation isn't unique)
5 001011
5 001100
5 010000

If I follow the same rules as for incrementing up to 4 I get the following
111 that's 4
last two digits are 11, so we change to 01 and report carry, therefore I get
(1+1)01 and that's
1001... which...damn, is not 5 but 4 so I did something wrong. I'll keep staring at my notebook and maybe I'll get it eventually
 
kaalen said:
Hmm, this is wrong
1 = 00001
2 = 00010 --> that's still 1
3 = 00011 = 00100 --> that's not 3, it's 2
4 = 00101 --> that's 3
5 = 00110 = 01000 --> that's 3
6 = 01001 --> that's 4

OK, you are using the digits (from right to left) to represent 1, 1, 2, 3, 5, etc

I ignored the duplicated "1" so my digits represent 1, 2, 3, 5, 8, etc.

So you can just add a "0" to the end of all my numbers, or replace every final "0" with "00" and every final 1" with "01". or there will be other ways to write some numbers ending in "11" .

It doesn't make any real difference, except it introduces even more alternative ways to write the same number.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 107 ·
4
Replies
107
Views
20K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 11 ·
Replies
11
Views
33K
  • · Replies 1 ·
Replies
1
Views
30K