OFFSET
1,2
COMMENTS
From A.H.M. Smeets, Nov 20 2017: (Start)
a(p*q^2) = b(p,q/gcd(A002349(p),q)) where
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)
REFERENCES
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.
C. F. Degen, Canon Pellianus. Hafniae, Copenhagen, 1817.
D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 55.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000 (first 1000 terms from T. D. Noe)
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. (Annotated scanned copy)
L. Beeckmans, Squares expressible as sum of consecutive squares, Amer. Math. Monthly, 101 (1994), 437-442.
L. Euler, De solutione problematum diophanteorum per numeros integros (English and Latin), par. 17.
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
FORMULA
a(prime(i)) = A081233(i). - R. J. Mathar, Feb 25 2025
EXAMPLE
For n = 1, 2, 3, 4, 5 solutions are (x,y) = (1, 0), (3, 2), (2, 1), (1, 0), (9, 4).
MATHEMATICA
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}]
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 *)
PROG
(Python)
from sympy.ntheory.primetest import is_square
from sympy.solvers.diophantine.diophantine import diop_DN
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
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
STATUS
approved