OFFSET
1,4
COMMENTS
Suppose that c and d are relatively prime integers satisfying 1 < c < d. Every integer n has a representation
(1) n = c*x + d*y
where x and y are integers satisfying
(2) |x - y| < d.
Let h = (c-1)*(d-1). If n >= h, there is exactly one pair (x,y) satisfying (1) and (2), and, for this pair, x >= 0 and y >= 0.
For n >= h, write (x,y) as (x(n),y(n)) and call this the (c,d)-Lagrange pair for n. If n > c*d then
(3) x(n) = x(n-c-d) + 1 and
(4) y(n) = y(n-c-d) + 1.
If n < h, then n may have more than one representation satisfying (1) and (2); e.g., 1 = 2*(-3) + 7*1 = 2*4 + 7*(-1). To extend the definition of (c,d)-Lagrange pair by stipulating a particular pair (x(n),y(n)) satisfying (1) and (2) for n < h, we reverse (3) and (4): x(n) = x(n+c+d) - 1 and y(n) = y(n+c+d) - 1 for all integers n. The initial numbers x(1) and y(1) so determined are also the numbers found by the Euclidean algorithm for 1 as a linear combination c*x + d*y.
Examples:
c d x(n) y(n)
- - ------- -------
REFERENCES
L. E. Dickson, History of the Theory of Numbers, vol. II: Diophantine Analysis, Chelsea, 1952, page 47.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,1,-1).
FORMULA
From Robert Israel, Jul 29 2019: (Start)
a(n+5) = a(n) + 1.
G.f.: x*(-1+2*x-x^2+2*x^3-x^4)/(1-x-x^5+x^6). (End)
a(n) = 2*n - 3*floor((3*n+2)/5). - Ridouane Oudra, Sep 06 2020
a(n) = n/5 + O(1). - Charles R Greathouse IV, Mar 30 2022
EXAMPLE
This table shows (x(n),y(n)) for 1 <= n <= 13:
n 1 2 3 4 5 6 7 8 9 10 11 12 13
---- -- -- -- -- -- -- -- -- -- -- -- -- --
x(n) -1 1 0 2 1 0 2 1 3 2 1 3 2
y(n) 1 0 1 0 1 2 1 2 1 2 3 2 3
MAPLE
A0:= [-1, 1, 0, 2, 0]:
f:= n -> A0[(n-1 mod 5)+1]+floor(n/5):
map(f, [$1..100]); # Robert Israel, Jul 29 2019
MATHEMATICA
c = 2; d = 3;
x1 = {-1, 1, 0, 2, 1}; y1 = {1, 0, 1, 0, 1};
x[n_] := If[n <= c + d, x1[[n]], x[n - c - d] + 1]
y[n_] := If[n <= c + d, y1[[n]], y[n - c - d] + 1]
Table[x[n], {n, 1, 100}] (* A194508 *)
Table[y[n], {n, 1, 100}] (* A194509 *)
r[1, n_] := n; r[2, n_] := x[n]; r[3, n_] := y[n]
TableForm[Table[r[m, n], {m, 1, 3}, {n, 1, 30}]]
PROG
(PARI) a(n)=2*n - (3*n+2)\5*3
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Clark Kimberling, Aug 27 2011
STATUS
approved