This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A194508 #26 Mar 30 2022 22:53:29 %S A194508 -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 A194508 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 A194508 13,12,14,13,12,14,13,15,14,13,15,14,16,15,14,16,15,17,16,15,17 %N A194508 First coordinate of the (2,3)-Lagrange pair for n. %C A194508 Suppose that c and d are relatively prime integers satisfying 1 < c < d. Every integer n has a representation %C A194508 (1) n = c*x + d*y %C A194508 where x and y are integers satisfying %C A194508 (2) |x - y| < d. %C A194508 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 A194508 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 A194508 (3) x(n) = x(n-c-d) + 1 and %C A194508 (4) y(n) = y(n-c-d) + 1. %C A194508 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 A194508 Examples: %C A194508 c d x(n) y(n) %C A194508 - - ------- ------- %C A194508 2 3 A194508 A194509 %C A194508 2 5 A194510 A194511 %C A194508 2 7 A194512 A194513 %C A194508 3 4 A194514 A194515 %C A194508 3 5 A194516 A194517 %C A194508 3 7 A194518 A194519 %C A194508 3 8 A194520 A194521 %C A194508 4 5 A194522 A194523 %C A194508 4 7 A194524 A194525 %C A194508 5 6 A194526 A194527 %C A194508 5 8 A194528 A194529 %D A194508 L. E. Dickson, History of the Theory of Numbers, vol. II: Diophantine Analysis, Chelsea, 1952, page 47. %H A194508 Robert Israel, <a href="/A194508/b194508.txt">Table of n, a(n) for n = 1..10000</a> %H A194508 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,1,-1). %F A194508 From _Robert Israel_, Jul 29 2019: (Start) %F A194508 a(n+5) = a(n) + 1. %F A194508 G.f.: x*(-1+2*x-x^2+2*x^3-x^4)/(1-x-x^5+x^6). (End) %F A194508 a(n) = 2*n - 3*floor((3*n+2)/5). - _Ridouane Oudra_, Sep 06 2020 %F A194508 a(n) = n/5 + O(1). - _Charles R Greathouse IV_, Mar 30 2022 %e A194508 This table shows (x(n),y(n)) for 1 <= n <= 13: %e A194508 n 1 2 3 4 5 6 7 8 9 10 11 12 13 %e A194508 ---- -- -- -- -- -- -- -- -- -- -- -- -- -- %e A194508 x(n) -1 1 0 2 1 0 2 1 3 2 1 3 2 %e A194508 y(n) 1 0 1 0 1 2 1 2 1 2 3 2 3 %p A194508 A0:= [-1,1,0,2,0]: %p A194508 f:= n -> A0[(n-1 mod 5)+1]+floor(n/5): %p A194508 map(f, [$1..100]); # _Robert Israel_, Jul 29 2019 %t A194508 c = 2; d = 3; %t A194508 x1 = {-1, 1, 0, 2, 1}; y1 = {1, 0, 1, 0, 1}; %t A194508 x[n_] := If[n <= c + d, x1[[n]], x[n - c - d] + 1] %t A194508 y[n_] := If[n <= c + d, y1[[n]], y[n - c - d] + 1] %t A194508 Table[x[n], {n, 1, 100}] (* A194508 *) %t A194508 Table[y[n], {n, 1, 100}] (* A194509 *) %t A194508 r[1, n_] := n; r[2, n_] := x[n]; r[3, n_] := y[n] %t A194508 TableForm[Table[r[m, n], {m, 1, 3}, {n, 1, 30}]] %o A194508 (PARI) a(n)=2*n - (3*n+2)\5*3 %Y A194508 Cf. A193509-A194529. %K A194508 sign,easy %O A194508 1,4 %A A194508 _Clark Kimberling_, Aug 27 2011