Talk:Lucas sequence

message: To clear up any confusion - the correct condition on P and Q is
:P^2-4Q \neq 0
as given by Paulo Ribenboim in My Numbers, My Friends. MathWorld incorrectly has the condition
:P^2-4Q > 0
but all the relations work equally well if P2-4Q is negative. Gandalf61 08:41, 5 May 2006 (UTC)
thread_title: Condition on ''P'' and ''Q''

message: Lucas sequences were first studied by French mathematician Edouard Lucas.
Is this really true? In general, the sequences of convergents in simple continued fraction expansions of quadratic surds contain embedded Lucas sequences. I understand that Lucas generalized the notion, and wrote quite a few papers about his generalized sequences. But Joseph Louis Lagrange (d. 1813) solved the general problem posed by Pell's equation, and Euler studied the convergents of continued fractions long before Lagrange did, so I think this sentence is stretching the truth, at a minimum.  DavidCBryant 23:09, 9 December 2006 (UTC)
replies: text: Changed "first studied by" to "named after". Gandalf61 12:21, 10 December 2006 (UTC)
replies: text: Thanks! Say, I noticed one other thing. Some of the equations in this article appear in a big font, and others are much smaller. (I'm talking about separate lines produced by a pair of  tags.) Is that intentional? Would it be OK if I fix them to all display in the larger font?  DavidCBryant 14:09, 10 December 2006 (UTC)
replies: text: Not intentional AFAIK, so feel free to fix ! Gandalf61 17:32, 10 December 2006 (UTC)
thread_title:  Clarification of opening 

message: I think I can improve it. Note that it is incorrect as it stands. Lots of sequences satisfy a give recurrence but only two (not) all of them qualify as Lucas sequences.--Gentlemath (talk) 06:59, 22 February 2009 (UTC)
thread_title:  Redoing opening and more 

message: There are lots of trivial relations in this article that are not at all specific to Lucas sequences, but belong to Recurrence_relation#Solving_generally. While in Ribenboim's book for example the case of real-valued terms is considered, I think that the properties that essentially make a 2nd order const.coeff recurrence a "Lucas sequence" are
* P²≠4Q,
* initial terms are (0, 1), resp. (2, P).
So it is confusing when the "general solution xn" is introduced later on in the article (and in particular the case D=0), while the introducing phrase is IMHO unnecessarily overcharged by notations Un(P,Q) and Vn(P,Q).— MFH:Talk 13:01, 3 March 2009 (UTC)
replies: text: There isn't lots of anything in this article because it is pretty short. One would usually assume that P and Q are relativey prime integers since their gcd divides all the terms after the first two. Then P^2-4Q<>0 rules out exactly one case, P=2 and Q=-1. It is not that interesting but all the relations hold, so what is lost by excluding it. Which relations do you think should be removed?  I support changing U_n(P,Q)  to U_n in more places (maybe all) but I'll let someone else do that. I have tracked down the history (E.L. Dickson History of Theory of numbers  Vol I chap XVII) in brief, Lucas employed the roots a and b of x^2-Px+Q=0 (where  P & Q are relatively prime integers) to define the two sequences U and V. The main goal was to to use the U to study primes. That is where some of those relations come in. I'm not sure if all that detail is needed. --Gentlemath (talk) 06:27, 6 March 2009 (UTC)
thread_title:  Mess (cont'd) 

message: Since Lucas himself used the letters P and Q with x^2=PX-Q, that is surely the appropriate convention. (although he may have used lower case u and v). I think that the article as it currently is in MathWorld is just about perfect. It includes just enough identities for fast calculation and mentions the important fact that primality proof is an important motivation with, again, just enough details to say why. (Actually I'd like to see a 127 by 127 binary array proving 2^127-1 is prime ...)
This article at one point incorrectly called any integer sequence satisfying a 2nd order homogenous linear recurrence a Lucas Sequence. In correcting that I left in that it is reasonable to use U and V as a basis for the set of all solutions. If the roots a and b are integers then obviously we would prefer a^n and b^n. I agree that that could come out although it does not lengthen things much. I figured better to transition it to a minor detail, let it rest and then let it either stay or evaporate completely. I think that 2nd order homogenous linear recurrences don't have a nice treatment in Wikipedia so it might be nice to create one before erasing the few lines devoted to it here. --Gentlemath (talk) 20:03, 6 March 2009 (UTC)
thread_title:  Credit where credit is due 

message: I can't understand this article because it's written for people who already know what it means, but it says: 
: Famous examples of Lucas sequences include the Fibonacci numbers, Pell numbers, Lucas numbers and Jacobsthal numbers.
The article on the rank-size distribution (concerning the size of cities in a country or region) says
:A special case of the Fibonacci sequence is the Lucas sequence consisting of these sequentially additive numbers 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, …
which seems to contradict this article. In particular I get the impression that the Lucas sequence is sort of a family of sequences, whereas the article on rank-size distribution seems to assert that the Fibonnaci sequence is more general and that there is only one Lucas sequence which follows that pattern.
Am I right in suspecting the other article is wrong? Would the following be a better re-write:
: Similar to the Fibonnaci sequence is the sequence consisting of the sequentially-additive numbers 1, 3, 4, ... (cf. Lucas sequences). 
There would also be the occasional consequential change later on (e.g. changing “the Lucas sequence as above” to “the sequence (as) above”).
Can anyone clarify this? Thanks!
—Felix the Cassowary 11:03, 1 September 2009 (UTC)
replies: text: The numbers 1, 3, 4, 7, 11, ... are Lucas numbers. Both Fibonacci numbers and Lucas numbers are examples of the more general idea of a Lucas sequence. The link in rank-size distribution should point to the Lucas number article, not the Lucas sequence article - I have fixed it. Gandalf61 (talk) 11:27, 1 September 2009 (UTC)
thread_title:  Fibonnacci and Lucas sequences 

message: I found a cool pattern with sequences with the recurrence xn=3*xn-1+xn-2. There are a lot of sequences starting with two 1-digit numbers that have 8-digit numbers of the form ABCDAECD. Here are some examples.
:1, 1, 4, 13, 43, 142, 469, 1549, 5116, 16897, 55807, 184318, 608761, 2010601, 6640564, 21932293, 72437443...
:2, 5, 17, 56, 185, 611, 2018, 6665, 22013, 72704, 240125, 793079, 2619861, 8651165, 28572857, 94369736...
That is a very interesting pattern! Bobby Jacobs (talk) 18:50, 14 April 2017 (UTC)
thread_title:  A cool pattern 

message: Hello fellow Wikipedians,
I have just modified one external link on Lucas sequence. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
*Added archive https://web.archive.org/web/20150202074230/http://www.joye.site88.net/papers/JQ96lucas.pdf to http://www.joye.site88.net/papers/JQ96lucas.pdf
When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.
Cheers.—InternetArchiveBot (Report bug) 01:32, 8 January 2018 (UTC)
thread_title:  External links modified 

message: The article section mentions "analog of exponentiation by repeated squaring". The concept used for this is similar (using bits of n as powers of 2), but it is not quite exponentiation or squaring. Example code to calculate Fibonacci(n) in O(log(n)) time. In some cases, p is used instead of c and q is used instead of d.
uint64_t fib(uint64_t n)
{
    uint64_t a, b, c, d;
    a = d = 1;
    b = c = 0;
    while (1) {
        if (n & 1) {
            uint64_t bd = b*d;
            b = bd + a*d + b*c;
            a = bd + a*c;
        }
        n >>= 1;
        if (n == 0)
            break;
        {
            uint64_t dd = d*d;
            d = dd + 2*d*c;
            c = dd + c*c;
        }
    }
    return b;
}
I had to create my own derivation for this code, as I could not find a reference for this anywhere. I started with the Lucas sequence relations, and used them to derive the algorithm for the code above.
Lucas sequence relations:
fib(m+1) = fib(m) + fib(m-1)
fib(m+n) = fib(m+1) fib(n) + fib(m) fib(n-1)
fib(2m)  = fib(m) lucas(m) = fib(m) (fib(m+1) + fib(m-1)) = fib(m+1) fib(m) + fib(m) fib(m-1)
initial state
c = fib(0) = 0
d = fib(1) = 1
for each iteration, p = 2^i
c = fib(p-1)
d = fib(p)
d' = fib(2p)
   = fib(p+1) fib(p) + fib(p) fib(p-1)
   = (fib(p) + fib(p-1)) fib(p) + fib(p) fib(p-1)
   = fib(p) fib(p) + fib(p) fib(p-1) + fib(p) fib(p-1)
   = fib(p) fib(p) + 2 fib(p) fib(p-1)
   = d d + 2 d c
c' = fib(2p-1) = fib(p+p-1)
   = fib(p+1) fib(p-1) + fib(p) fib(p-2)
   = (fib(p) + fib(p-1)) fib(p-1) + fib(p) (fib(p) - fib(p-1))
   = fib(p-1) fib(p) + fib(p-1) fib(p-1) + fib(p) fib(p) - fib(p) fib(p-1)
   = fib(p) fib(p) + fib(p-1) fib(p-1)
   = d d + c c
initial state
a = fib(-1) = 1
b = fib( 0) = 0
during the calculation, m = current cumulative bits of n 
a = fib(m-1)
b = fib(m)
when a bit of n == 1, then a and b are updated:
b' = fib(m+p)
   = fib(m+1)fib(p) + fib(m)fib(p-1)
   = (fib(m) + fib(m-1))fib(p) + fib(m)fib(p-1)
   = fib(m)fib(p) + fib(m-1)fib(p) + fib(m)fib(p-1)
   = bd           + ad             + bc
a' = fib(m-1+p)
   = fib(m)fib(p) + fib(m-1)fib(p-1)
   = bd           + ac
Rcgldr (talk) 10:50, 21 February 2020 (UTC)
thread_title:  Where to find an explanation of analog of exponentiation via repeated squaring method for U(1,-1) (Fibonacci)