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 A002350 M2240 N0890 #79 Feb 25 2025 08:49:18 %S A002350 1,3,2,1,9,5,8,3,1,19,10,7,649,15,4,1,33,17,170,9,55,197,24,5,1,51,26, %T A002350 127,9801,11,1520,17,23,35,6,1,73,37,25,19,2049,13,3482,199,161,24335, %U A002350 48,7,1,99,50,649,66249,485,89,15,151,19603,530,31,1766319049,63,8,1 %N A002350 Take solution to Pellian equation x^2 - n*y^2 = 1 with smallest positive y and x >= 0; sequence gives a(n) = x, or 1 if n is a square. A002349 gives values of y. %C A002350 From _A.H.M. Smeets_, Nov 20 2017: (Start) %C A002350 a(p*q^2) = b(p,q/gcd(A002349(p),q)) where %C A002350 b(p,0) = 1, b(p,1) = a(p), b(p,i) = 2*a(p)*b(p,i-1) - b(p,i-2) for i>1. (End) %D A002350 A. Cayley, Report of a committee appointed for the purpose of carrying on the tables connected with the Pellian equation ..., Collected Mathematical Papers. Vols. 1-13, Cambridge Univ. Press, London, 1889-1897, Vol. 13, pp. 430-443. %D A002350 C. F. Degen, Canon Pellianus. Hafniae, Copenhagen, 1817. %D A002350 D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 55. %D A002350 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence). %D A002350 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A002350 Ray Chandler, <a href="/A002350/b002350.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe) %H A002350 A. Cayley, <a href="/A002349/a002349.pdf">Report of a committee appointed for the purpose of carrying on the tables connected with the Pellian equation ...</a>, Collected Mathematical Papers. Vols. 1-13, Cambridge Univ. Press, London, 1889-1897, Vol. 13, pp. 430-443. (Annotated scanned copy) %H A002350 L. Beeckmans, <a href="http://www.jstor.org/stable/2974904">Squares expressible as sum of consecutive squares</a>, Amer. Math. Monthly, 101 (1994), 437-442. %H A002350 L. Euler, <a href="http://math.dartmouth.edu/~euler/pages/E029.html">De solutione problematum diophanteorum per numeros integros</a> (English and Latin), par. 17. %H A002350 N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references) %F A002350 a(prime(i)) = A081233(i). - _R. J. Mathar_, Feb 25 2025 %e A002350 For n = 1, 2, 3, 4, 5 solutions are (x,y) = (1, 0), (3, 2), (2, 1), (1, 0), (9, 4). %t A002350 PellSolve[(m_Integer)?Positive] := Module[{cf, n, s}, cf = ContinuedFraction[ Sqrt[m]]; n = Length[ Last[cf]]; If[ OddQ[n], n = 2*n]; s = FromContinuedFraction[ ContinuedFraction[ Sqrt[m], n]]; {Numerator[s], Denominator[s]}]; f[n_] := If[ !IntegerQ[ Sqrt[n]], PellSolve[n][[1]], 1]; Table[ f[n], {n, 0, 65}] %t A002350 Table[If[! IntegerQ[Sqrt[k]], {k, FindInstance[x^2 - k*y^2 == 1 && x > 0 && y > 0, {x, y}, Integers]}, Nothing], {k, 2, 80}][[All, 2, 1, 1, 2]] (* _Horst H. Manninger_, Mar 23 2021 *) %o A002350 (Python) %o A002350 from sympy.ntheory.primetest import is_square %o A002350 from sympy.solvers.diophantine.diophantine import diop_DN %o A002350 def A002350(n): return 1 if is_square(n) else next(a for a,b in diop_DN(n,1)) # _Chai Wah Wu_, Feb 11 2025 %Y A002350 Cf. A002349, A006702, A006703, A006704, A006705. See A033316, A033315, A033319 for records. %K A002350 nonn,nice,easy %O A002350 1,2 %A A002350 _N. J. A. Sloane_