cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Zeckendorf representation with Lucas numbers ?

lvl107
20-Turquoise

Zeckendorf representation with Lucas numbers ?

Hello Everyone.

From :

(1).png

(2).PNG

(3).PNG

The question is : Need help creating a Program Function for "Zeckendorf Representation for Natural Number (2017) with Lucas Numbers ?

      Thanks in advance for your time and help.

            Best Regards.

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:lvl107)

Here you are. The problem was that the first two Lucas numbers are not in sequence and so had to be treated differently to return the correct index for the first two sequence elements. This is solved now in a different way and the routine works OK as long as the initial value is >=0

View solution in original post

8 REPLIES 8
Werner_E
24-Ruby V
(To:lvl107)

Isn't that a quite easy task?

Or am I missing the point?

lvl107
20-Turquoise
(To:Werner_E)

I'm very, very happy with your answer, Werner. .   I greatly appreciate your time and help.

     Best Regards.

Werner_E
24-Ruby V
(To:lvl107)

Here's a slightly modified version which returns the numbers themselves, too.

lvl107
20-Turquoise
(To:Werner_E)

Thanks again, Werner. I very,very . And I guess your Program Function could apply for : "Zeckendorf representation for certain Natural number with both of Fibonacci numbers and Lucas numbers :

(4).PNG

But I guess : "Zeckendorf representation for certain Natural number with Fibonacci numbers" would choose  F[2 instead of F[1  ???

(5).PNG

So could we modify the Program Function above suit with Zeckendorf representation and apply to both of Fibonacci numbers and Lucas numbers ?

         Best Regards.

              Loi

Werner_E
24-Ruby V
(To:lvl107)

Here you are. The problem was that the first two Lucas numbers are not in sequence and so had to be treated differently to return the correct index for the first two sequence elements. This is solved now in a different way and the routine works OK as long as the initial value is >=0

lvl107
20-Turquoise
(To:Werner_E)

M...o...r...e   than ...

    Best Regards.

lvl107
20-Turquoise
(To:Werner_E)

and the routine works OK as long as the initial value is >=0  ??                initial value must be ~(8) , because :

(6).PNG

       Best Regards.

Werner_E
24-Ruby V
(To:lvl107)

Yes, the indices are correct only if we use a sequence where a unique representation with a sum of sequence numbers exists and each number only appears at max once.

You may change the routine by going through the array at the end of the routine and if initial was > 1 then exchange EVERY index 0 for index 1 and vice versa.

As the routine is now only the first index is treated that way because its assumed that every number occurs at most one times.

Top Tags