OFFSET
1,1
COMMENTS
D = D(n) = A000037(n). - Wolfdieter Lang, Oct 04 2015
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Laurent Beeckmans, Squares Expressible as Sum of Consecutive Squares, Am. Math. Monthly, Volume 101, Number 5, page 442, May 1994.
S. R. Finch, Class number theory [Cached copy, with permission of the author]
Bernard Frénicle de Bessy, Solutio duorum problematum circa numeros cubos et quadratos, (1657). Bibliothèque Nationale de Paris. See column B page 19.
N. J. A. Sloane et al., Binary Quadratic Forms and OEIS (Index to related sequences, programs, references)
Eric Weisstein's World of Mathematics, Pell Equation
FORMULA
MAPLE
F:= proc(d) local r, Q; uses numtheory;
Q:= cfrac(sqrt(d), 'periodic', 'quotients'):
r:= nops(Q[2]);
if r::odd then
denom(cfrac([op(Q[1]), op(Q[2]), op(Q[2][1..-2])]))
else
denom(cfrac([op(Q[1]), op(Q[2][1..-2])]));
fi
end proc:
map(F, remove(issqr, [$1..100])); # Robert Israel, May 17 2015
MATHEMATICA
PellSolve[(m_Integer)?Positive] := Module[{cf, n, s}, cf = ContinuedFraction[Sqrt[m]]; n = Length[Last[cf]]; If[n == 0, Return[{}]]; If[OddQ[n], n = 2n]; s = FromContinuedFraction[ContinuedFraction[Sqrt[m], n]]; {Numerator[s], Denominator[s]}];
A033317 = DeleteCases[PellSolve /@ Range[100], {}][[All, 2]] (* Jean-François Alcover, Nov 21 2020, after N. J. A. Sloane in A002349 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved