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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

19-Tanzanite

## Zeckendorf representation with Lucas numbers ?

Hello Everyone.

From :

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

Best Regards.

1 ACCEPTED SOLUTION

Accepted Solutions
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

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

Isn't that a quite easy task?

Or am I missing the point?

19-Tanzanite
(To:Werner_E)

Best Regards.

24-Ruby V
(To:lvl107)

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

19-Tanzanite
(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 :

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

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

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

19-Tanzanite
(To:Werner_E)

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

Best Regards.

19-Tanzanite
(To:Werner_E)

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

Best Regards.

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.

Announcements