23 11
Article 04.1.4 3
6 47
The Greatest Common Divisor
of Two Recursive Functions
Jan-Christoph Schlage-Puchta and J¨
urgen Spilker
Mathematisches Institut
Eckerstr. 1
79104 Freiburg
Germany
jcp@math.uni-freiburg.de
Juergen.Spilker@math.uni-freiburg.de
Abstract
Letg, hbe solutions of a linear recurrence relation of length 2. We show that under some mild assumptions the greatest common divisor of g(n) and h(n) is periodic as a function of
n and compute its mean value.
1. Problems and Results
Leta, b be coprime integers,b 6= 0, and consider the recurrence relation
f(n+ 2) =af(n+ 1) +bf(n), n∈N0. (1)
Letg, h:N0 →Z be solutions of (1) with
|g(n)|+|h(n)|>0 (2)
for alln∈N0. We define the gcd function t(n) = gcd(g(n), h(n)) and consider two problems.
Problem 1. Under which conditions ong and his the function t(n) periodic?
Problem 2. Ift(n) is periodic, what is the mean value of t(n)?
We first need a
Definition. We call a function f :N0 →Z periodic andq ∈N a period off, iff there exists somen0 ∈N0 such thatf(n) = f(n+q) for all n≥n0. If one can choose n0 = 0,f is called
simply periodic.
In this note we prove the following two theorems.
Theorem 1. Let g, h : N0 → Z be solutions of (1) satisfying (2), and assume that c :=
g(1)h(0)−g(0)h(1) 6= 0. Then
(a) the function t(n) is periodic, moreover, if gcd(b, c) = 1, it is simply periodic; (b) every common period of g(n) mod|c| and h(n) mod |c| is a period oft(n); (c) for all n ∈N0 we have t(n)|c.
Theorem 2. Let g, h:N0 →Z be solutions of (1) satisfying (2), and assume that g(0) = 0,
g(1) = 1, c := h(0) 6= 0 and gcd(b, c) = 1. Then the mean value of t(n)equals P
d|c ϕ(d)
k(d),
where k(d) := min{n ∈N:d|g(n)}.
Examples. 1. In the case g(0) = 0, g(1) = 1, h(0) = 2, h(1) =a, McDaniel [1] has shown, thatt(n) is 1 or 2 for n∈N. This follows also from our Theorem 1 (c). If further a=b = 1, we obtain the Fibonacci function (resp., Lucas function). Since g(n) mod 2 and h(n) mod 2 are simply periodic with period 3, we get
t(n) = ½
2, n≡0 (mod 3); 1, n6≡0 (mod 3),
with mean value 43. This is a well-known result (see e.g., [2], [3]).
2. Definingg and h bya= 1, b= 2, g(0) =h(0) = 1, g(1) = 2, h(1) = 0, we obtain the gcd function
t(n) = ½
1, n= 0 2, n≥1 , which is periodic, but not simply periodic.
Remarks. 1. The assumption gcd(a, b) = 1 in Theorem 1 is necessary, since for every common divisor d of a and b we have
dn|t(2n), n∈N.
Ifd >1, t(n) is unbounded, hence not periodic.
2. The gcd functions of recurrences of higher order need not be periodic. The companion polynomial (x−1)(x−2)(x−3) corresponds to
f(n+ 3) = 6f(n+ 2)−11f(n+ 1) + 6f(n), n ∈N0.
It has solutions g(n) = 2n+1−1 and h(n) = 3n+1−1 with c=−2. If p≥5 is a prime, and n≡ −1 (mod p−1), then
t(n) = gcd(2n+1−1,3n+1−1)≡0 (mod p)
and t(n)≥p; hence, t(n) is not bounded and a forteriori not periodic.
3. The functionℓ(d) does not depend on the period q of t(n) modd. If f(n) is the solution of (1) with initial values f(0) = 0, f(1) = 1 (the generalized Fibonacci function), one can take any period q of f(n) modd: We have
g(n) = (g(1)−ag(0))f(n) +g(0)f(n+ 1), n∈N0,
hence, q is a period of g(n) modd, and similarly for h(n) modd, thus q is a period of
4. The mean valueM oft(n) depends only on the determinantcof the initial values ofg and
h. It is unbounded as a function of m =|c|, even if g(0) = 0, g(1) = 1, since k(d) ≤ d4ω(d)
(see [3]) implies
M ≥X
d|m
ϕ(d)
d4ω(d) =
Y
pjkm
µ
1 + p−1 4p j
¶
≥
µ 9 8
¶ω(m)
5. The assumption gcd(b, c) = 1 in Theorem 2 is necessary, however, there is always some
n0 such that the function ˜t(n) = t(n+n0) has the same mean value as t(n) and the mean value formula holds true for ˜t.
2. Proofs
We first need two lemmas, which are well-known for the classical Fibonacci function (see [2]).
Lemma 1. Let f : N0 → Z be a solution of (1), and d ∈ N. Then the function n 7→
f(n) modd is periodic, and simply periodic if gcd(b, d) = 1.
Proof. There are positive integers n1 < n2, such that both f(n1) ≡ f(n2) (mod d) and f(n1+ 1)≡ f(n2+ 1) (mod d). Then q = n2 −n1 is a period of f(n) mod d, since by (1), f(n +q) ≡ f(n) (mod d) for all n ≥ n1. Assume that f(n0 +q) 6≡ f(n0) (mod d), and
choosen0 maximal with this property. Then by (1), we have mod d the congruences bf(n0) = f(n0+ 2)−af(n0+ 1)
≡ f(n0+q+ 2)−af(n0+q+ 1)
= bf(n0+q).
If gcd(b, d) = 1, this gives the contradiction f(n0)≡f(n0+q) (mod d). ¤
Lemma 2. Letf :N0 →Zbe the generalized Fibonacci solution of (1), i.e.,f(0) = 0, f(1) = 1. Then
(a) gcd(f(n), f(n+ 1)) = 1, n ∈N0;
(b) f(m+n) = f(m+ 1)f(n) +bf(m)f(n−1), m∈N0, n∈N; (c) if d, n ∈N, and k(d) = min{n∈N:d|f(n)}, then ¡
d|f(n)⇔k(d)|n¢ .
Proof. (a). Letpbe a prime, andnbe the least integer withp|f(n), p|f(n+1); in particular,
n >1. The equationf(n+ 1) =af(n) +bf(n−1) impliesp|bf(n−1), hence, p|b. Similarly,
f(n) =af(n−1) +bf(n−2) impliesp|af(n−1), thusp|a. This contradicts the assumption gcd(a, b) = 1.
(b). This follows by induction onn.
(c). LetL:={n ∈N0 :d|f(n)}. If m, n∈L, we get m+n∈L by (b)., and if m > n, we havef(m) =f(m−n)f(n+1)+bf(m−n−1)f(n), hence, d|f(m−n)f(n+1), som−n∈L
by (a). Take n ∈ L and write n =mk(d) +t with 0 ≤t < k(d). Since t= n−mk(d) ∈L, we have t= 0 and L=k(d)·N0. This proves the last claim. ¤
Proof of Theorem 1. Let f : N0 → Z be the solution of (1) with initial values f(0) = 0, f(1) = 1. We have
since both sides solve (1), and the initial values are 0 and c. Similarly,
and by Theorem 1 (c), this quantity is equal to 1
q
the inner sum can be written as
We finally get by Lemma 2 (c) for everyd|m
#{n≤q:d|t(n)}= X
1≤n≤q d|g(n)
1 = X
1≤n≤q k(d)|n
1 = q
k(d),
and Theorem 2 is proven. ¤
References
[1] W. L. McDaniel, The g.c.d in Lucas sequences and Lehmer number sequences. Fibonacci Quart. 29 (1991), 24–29.
[2] V. E. Hoggatt,Fibonacci and Lucas numbers, Boston etc.: Houghton Mifflin Company IV, 1969. [3] D. D. Wall, Fibonacci series modulom,Amer. Math. Monthly67(1960), 525–532.
2000 Mathematics Subject Classification: Primary 11B37; Secondary 11B39, 11A05.
Keywords: Greatest common divisor, recursive functions, periodic functions, mean values.
Received October 8 2003; revised version received January 27 2004. Published inJournal of Integer Sequences, February 16 2004.