%I
%S -1,1,0,2,1,0,2,1,3,2,1,3,2,4,3,2,4,3,5,4,3,5,4,6,5,4,6,5,7,6,5,7,6,8,
%T 7,6,8,7,9,8,7,9,8,10,9,8,10,9,11,10,9,11,10,12,11,10,12,11,13,12,11,
%U 13,12,14,13,12,14,13,15,14,13,15,14,16,15,14,16,15,17,16,15,17
%N First coordinate of the (2,3)-Lagrange pair for n.
%C Suppose that c and d are relatively prime integers satisfying 1 < c < d. Every integer n has a representation
%C (1) n = c*x + d*y
%C where x and y are integers satisfying
%C (2) |x - y| < d.
%C 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.
%C 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
%C (3) x(n) = x(n-c-d) + 1 and
%C (4) y(n) = y(n-c-d) + 1.
%C 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.
%C Examples:
%C c d x(n) y(n)
%C - - ------- -------
%C 2 3 A194508 A194509
%C 2 5 A194510 A194511
%C 2 7 A194512 A194513
%C 3 4 A194514 A194515
%C 3 5 A194516 A194517
%C 3 7 A194518 A194519
%C 3 8 A194520 A194521
%C 4 5 A194522 A194523
%C 4 7 A194524 A194525
%C 5 6 A194526 A194527
%C 5 8 A194528 A194529
%D L. E. Dickson, History of the Theory of Numbers, vol. II: Diophantine Analysis, Chelsea, 1952, page 47.
%H Robert Israel, <a href="/A194508/b194508.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,1,-1).
%F From _Robert Israel_, Jul 29 2019: (Start)
%F a(n+5) = a(n) + 1.
%F G.f.: x*(-1+2*x-x^2+2*x^3-x^4)/(1-x-x^5+x^6). (End)
%F a(n) = 2*n - 3*floor((3*n+2)/5). - _Ridouane Oudra_, Sep 06 2020
%e This table shows (x(n),y(n)) for 1 <= n <= 13:
%e n 1 2 3 4 5 6 7 8 9 10 11 12 13
%e ---- -- -- -- -- -- -- -- -- -- -- -- -- --
%e x(n) -1 1 0 2 1 0 2 1 3 2 1 3 2
%e y(n) 1 0 1 0 1 2 1 2 1 2 3 2 3
%p A0:= [-1,1,0,2,0]:
%p f:= n -> A0[(n-1 mod 5)+1]+floor(n/5):
%p map(f, [$1..100]); # _Robert Israel_, Jul 29 2019
%t c = 2; d = 3;
%t x1 = {-1, 1, 0, 2, 1}; y1 = {1, 0, 1, 0, 1};
%t x[n_] := If[n <= c + d, x1[[n]], x[n - c - d] + 1]
%t y[n_] := If[n <= c + d, y1[[n]], y[n - c - d] + 1]
%t Table[x[n], {n, 1, 100}] (* A194508 *)
%t Table[y[n], {n, 1, 100}] (* A194509 *)
%t r[1, n_] := n; r[2, n_] := x[n]; r[3, n_] := y[n]
%t TableForm[Table[r[m, n], {m, 1, 3}, {n, 1, 30}]]
%Y Cf. A193509-A194529.
%K sign
%O 1,4
%A _Clark Kimberling_, Aug 27 2011
|