cp's OEIS Frontend

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.

Showing 1-7 of 7 results.

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.

Original entry on oeis.org

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, 127, 9801, 11, 1520, 17, 23, 35, 6, 1, 73, 37, 25, 19, 2049, 13, 3482, 199, 161, 24335, 48, 7, 1, 99, 50, 649, 66249, 485, 89, 15, 151, 19603, 530, 31, 1766319049, 63, 8, 1
Offset: 1

Views

Author

Keywords

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)

Examples

			For n = 1, 2, 3, 4, 5 solutions are (x,y) = (1, 0), (3, 2), (2, 1), (1, 0), (9, 4).
		

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).

Crossrefs

Programs

  • 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 *)
  • 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

Formula

a(prime(i)) = A081233(i). - R. J. Mathar, Feb 25 2025

A002349 Take solution to Pellian equation x^2 - n*y^2 = 1 with smallest positive y and x >= 0; sequence gives a(n) = y, or 0 if n is a square. A002350 gives values of x.

Original entry on oeis.org

0, 2, 1, 0, 4, 2, 3, 1, 0, 6, 3, 2, 180, 4, 1, 0, 8, 4, 39, 2, 12, 42, 5, 1, 0, 10, 5, 24, 1820, 2, 273, 3, 4, 6, 1, 0, 12, 6, 4, 3, 320, 2, 531, 30, 24, 3588, 7, 1, 0, 14, 7, 90, 9100, 66, 12, 2, 20, 2574, 69, 4, 226153980, 8, 1, 0, 16, 8, 5967, 4, 936, 30, 413, 2, 267000, 430, 3
Offset: 1

Views

Author

Keywords

Examples

			For n = 1, 2, 3, 4, 5 solutions are (x,y) = (1, 0), (3, 2), (2, 1), (1, 0), (9, 4).
		

References

  • Albert H. Beiler, "The Pellian" (chap 22), Recreations in the Theory of Numbers, 2nd ed. NY: Dover, 1966.
  • 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).
  • E. E. Whitford, The Pell Equation.

Crossrefs

Programs

  • Mathematica
    a[n_] := If[IntegerQ[Sqrt[n]], 0, For[y=1, !IntegerQ[Sqrt[n*y^2+1]], y++, Null]; y]
    (* Second program: *)
    PellSolve[(m_Integer)?Positive] := Module[{cof, n, s}, cof = ContinuedFraction[ Sqrt[m]]; n = Length[ Last[cof]]; If[ OddQ[n], n = 2*n]; s = FromContinuedFraction[ ContinuedFraction[ Sqrt[m], n]]; {Numerator[s], Denominator[s]}]; f[n_] := If[ !IntegerQ[ Sqrt[n]], PellSolve[n][[2]], 0]; Table[ f[n], {n, 0, 75}]
  • Python
    from sympy.ntheory.primetest import is_square
    from sympy.solvers.diophantine.diophantine import diop_DN
    def A002349(n): return 0 if is_square(n) else next(b for a,b in diop_DN(n,1)) # Chai Wah Wu, Feb 11 2025

Formula

a(prime(i)) = A081234(i). - R. J. Mathar, Feb 25 2025

Extensions

More terms from Enoch Haga, Mar 14 2002
Better description from Robert G. Wilson v, Apr 14 2003

A006702 Solution to a Pellian equation: least x such that x^2 - n*y^2 = +- 1.

Original entry on oeis.org

1, 1, 2, 1, 2, 5, 8, 3, 1, 3, 10, 7, 18, 15, 4, 1, 4, 17, 170, 9, 55, 197, 24, 5, 1, 5, 26, 127, 70, 11, 1520, 17, 23, 35, 6, 1, 6, 37, 25, 19, 32, 13, 3482, 199, 161, 24335, 48, 7, 1, 7, 50, 649, 182, 485, 89, 15, 151, 99, 530, 31, 29718, 63, 8, 1, 8, 65, 48842
Offset: 1

Views

Author

Keywords

Comments

When n is a square, the trivial solution x=1, y=0 is taken; otherwise we take the least x that satisfies either the +1 or -1 equation. - T. D. Noe, May 19 2007
Apparently the generating function of the sequence of the denominators of continued fraction convergents to sqrt(n) is always rational and of form p(x)/[1 - C*x^m + (-1)^m * x^(2m)], or equivalently, the denominators satisfy the linear recurrence b(n+2m) = C*b(n+m) - (-1)^m * b(n). If so, then it seems that a(n) is half the value of C for each nonsquare n, or 1. See A003285 for the conjecture regarding m. The same conjectures apply to the sequences of the numerators of continued fraction convergents to sqrt(n). - Ralf Stephan, Dec 12 2013
The conjecture is true, cf. link. - Jan Ritsema van Eck, Mar 08 2021

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 and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    r[x_, n_] := Reduce[y > 0 && (x^2 - n*y^2 == -1 || x^2 - n*y^2 == 1 ), y, Integers];
    a[n_ /; IntegerQ[ Sqrt[n]]] = 1;
    a[n_] := a[n] = (k = 1; While[ r[k, n] === False, k++]; k);
    Table[ Print[ a[n] ]; a[n], {n, 1, 67}] (* Jean-François Alcover, Jan 30 2012 *)
    nmax = 500;
    nconv = 200; (* The number of convergents 'nconv' should be increased if the linear recurrence is not found for some terms. *)
    a[n_] := a[n] = Module[{lr}, If[IntegerQ[Sqrt[n]], 1, lr = FindLinearRecurrence[Numerator[Convergents[Sqrt[n], nconv]]]; SelectFirst[lr, #>1&]/2]];
    Table[Print[n, " ", a[n] ]; a[n], {n, 1, nmax}] (* Jean-François Alcover, Feb 22 2021 *)

Extensions

Corrected and extended by T. D. Noe, May 19 2007

A077233 a(n) is smallest natural number satisfying Pell equation b^2- d(n)*a^2= +1 or = -1, with d(n)=A000037(n) (nonsquare). Corresponding smallest b(n)=A077232(n).

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 1, 3, 2, 5, 4, 1, 1, 4, 39, 2, 12, 42, 5, 1, 1, 5, 24, 13, 2, 273, 3, 4, 6, 1, 1, 6, 4, 3, 5, 2, 531, 30, 24, 3588, 7, 1, 1, 7, 90, 25, 66, 12, 2, 20, 13, 69, 4, 3805, 8, 1, 1, 8, 5967, 4, 936, 30, 413, 2, 125, 5, 3, 6630, 40, 6, 9, 1, 1, 9, 6, 41, 1122, 3, 21, 53, 2, 165, 120, 1260, 221064, 4, 5, 569, 10, 1, 1, 10, 22419
Offset: 1

Views

Author

Wolfdieter Lang, Nov 08 2002

Keywords

Comments

If d(n)=A000037(n) is from A003654 (that is if the regular continued fraction for sqrt(d(n)) has odd (primitive) period length) then the -1 option applies. For such d(n) the minimal b(n) and a(n) numbers for the +1 option are 2*b(n)^2 + 1 and 2*b(n)*a(n), respectively (see Perron I, pp. 94,p5).
For general integer solutions see A077232 comments.
If the trivial solution x=1, y=0 is included, the sequence becomes A006703. - T. D. Noe, May 17 2007

Examples

			d=10=A000037(7)=A003654(3), therefore a(7)=1 and b(7)=A077232(7)=3 give 3^2=10*1^2 -1 and 2*b(7)^2+1=19 and 2*b(7)*a(7)=2*3*1=6 satisfy 19^2 - 10*6^2 = +1.
d=11=A000037(8) is not in A003654, therefore there is no (nontrivial) solution of the b^2 - d*a^2 = -1 Pell equation and a(8)=3 and b(8)=A077232(8)=10 satisfy 10^2 - 11*3^2 = +1. See A077232 for further examples.
		

References

  • T. Nagell, "Introduction to Number Theory", Chelsea Pub., New York, 1964, table p. 301.
  • O. Perron, "Die Lehre von den Kettenbruechen, Bd.I", Teubner, 1954, 1957 (Sec. 26, p. 91 with explanation on pp. 94,95).

Crossrefs

Programs

  • Mathematica
    nmax = 500;
    nconv = 200; (* The number of convergents 'nconv' should be increased if the linear recurrence is not found for some terms. *)
    nonSquare[n_] := n + Round[Sqrt[n]];
    b[n_] := b[n] = Module[{lr}, lr = FindLinearRecurrence[ Numerator[ Convergents[ Sqrt[nonSquare[n]], nconv]]]; (1/2) SelectFirst[lr, #>1&]];
    a[n_] := If[n == 1, 1, SelectFirst[{Sqrt[(b[n]^2 - 1)/nonSquare[n]], Sqrt[(b[n]^2 + 1)/nonSquare[n]]}, IntegerQ]];
    Table[Print[n, " ", a[n]]; a[n], {n, 1, nmax}] (* Jean-François Alcover, Mar 10 2021 *)

Formula

a(n)=sqrt((A077232(n)^2 - (-1)^(c(n)))/A000037(n)) with c(n)=1 if A000037(n)=A003654(k) for some k>=1 else c(n)=0.

A068717 a(n) = -1 if A067280(n) == 0 (mod 2), otherwise a(n) = A049240(n).

Original entry on oeis.org

0, -1, 1, 0, -1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 0, -1, 1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 0, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 0, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Frank Ellermann, Feb 25 2002

Keywords

Comments

Previous name was: x*x - n*y*y = +-1 has infinitely many solutions in integers (x,y).

Examples

			a(2)= -1: x*x - 2*y*y = -1 is soluble, e.g., 7*7 - 2*5*5 = -1.
		

References

  • H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, table 1.

Crossrefs

Programs

  • Python
    from math import isqrt
    from sympy import continued_fraction_periodic
    def A068717(n): return 0 if (a:=isqrt(n)**2==n) else (-1 if len(continued_fraction_periodic(0,1,n)[1]) & 1 else 1-int(a)) # Chai Wah Wu, Jun 14 2022

Formula

a(n) = -1 if A067280(n) == 0 (mod 2), otherwise a(n) = A049240(n).

Extensions

New name from formula by Joerg Arndt, Aug 29 2020

A068716 a(n) = 1 if x^2 + 1 = n * y^2 has infinitely many solutions in integers (x,y), otherwise a(n) = 0.

Original entry on oeis.org

0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Frank Ellermann, Feb 25 2002

Keywords

Examples

			a(2) = 1 as x*x + 1 = 2 * y*y is soluble, e.g., 7*7 + 1= 2*5*5.
		

References

  • H. Davenport, The Higher Arithmetic. Cambridge Univ. Press, 7th ed., 1999, table 1.

Crossrefs

Formula

a(n) = 1 - (A067280(n) mod 2 ).

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Mar 31 2003

A175155 Numbers m satisfying m^2 + 1 = x^2 * y^3 for positive integers x and y.

Original entry on oeis.org

0, 682, 1268860318, 1459639851109444, 2360712083917682, 86149711981264908618, 4392100110703410665318, 8171493471761113423918890682, 15203047261220215902863544865414318, 5484296027914919579181500526692857773246, 28285239023397517753374058381589688919682, 12439333951782387734360136352377558500557329868
Offset: 1

Views

Author

Michel Lagneau, Feb 27 2010

Keywords

Comments

This sequence is infinite. The fundamental solution of m^2 + 1 = x^2 y^3 is (m,x,y) = (682,61,5), which means the Pellian equation m^2 - 125x^2 = -1 has the solution (m,x) = (682,61) = (m(1),x(1)). This Pellian equation admits an infinity of solutions (m(2k+1),x(2k+1)), k=1,2,..., given by the following recursive relation, starting with m(1)=682, x(1)= 61: m(2k+1) + x(2k+1)*sqrt(125) = (m(1) + x(1)*sqrt(125))^(2k+1).
Squares of these terms are in A060355, since both a(n)^2 and a(n)^2 + 1 are powerful (A001694). - Charles R Greathouse IV, Nov 16 2012
It appears that y = A077426. - Robert G. Wilson v, Nov 16 2012
Also m^2 + 1 is powerful. Other solutions arise from solutions x to x^2 - k^3*y^2 = -1. - Georgi Guninski, Nov 17 2012
Although it is believed that the b-file is complete for all terms m < 10^100, the search only looked for y < 100000. - Robert G. Wilson v, Nov 17 2012

Examples

			For m=682, m^2 + 1 = 465125 = 61^2 * 5^3.
		

References

  • Albert H. Beiler, "The Pellian" (Chap. 22), Recreations in the Theory of Numbers, 2nd ed. NY: Dover, 1966.
  • 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.
  • J. M. De Koninck, Ces nombres qui nous fascinent, Ellipses, 2008, p. 108.

Crossrefs

Programs

  • Maple
    C:=array(0..20,0..20):C[1,1]=1: C[2,1]=1: n1:=682:x1:=61:for nn from 1 by 2 to 15 do:s:=0:for i from 2 to 15 do:for j from 1 to i do:C[i,j]:= C[i-1,j] + C[i-1,j-1]: od:od:for n from 1 by 2 to nn+1 do:s:=s + C[nn+1,n] * n1^(nn-n+1)*x1^(n-1)*125^((n-1)/2):od:print (s):od: # Michel Lagneau
    # 2nd program R. J. Mathar, Mar 16 2016:
    # print (nonsorted!) all solutions of A175155 up to search limit
    with(numtheory):
    # upper limit for solutions n
    nsearchlim := 10^40 :
    A175155y := proc(y::integer)
        local disc;
        disc := y^3 ;
        cfrac(sqrt(disc),periodic,quotients) ;
    end proc:
    for y from 2 do
        if issqrfree(y) then
            # find continued fraction for x^2-(y^3=disc)*y^2=-1, sqrt(disc)
            cf := A175155y(y) ;
            nlen :=  nops(op(2,cf)) ;
            if type(nlen,odd) then
                # fundamental solution
                fuso := numtheory[nthconver](cf,nlen-1) ;
                fusolx := numer(fuso) ;
                fusoly := denom(fuso) ;
                solx := fusolx ;
                soly := fusoly ;
                while solx <= nsearchlim do
                    rhhs := solx^2-y^3*soly^2 ;
                    if rhhs = -1 then
                        # print("n=",solx,"x=",soly,"y=",y^3) ;
                        print(solx) ;
                    end if;
                    # solutions from fundamental solution
                    tempx := fusolx*solx+y^3*fusoly*soly ;
                    tempy := fusolx*soly+fusoly*solx ;
                    solx := tempx ;
                    soly := tempy ;
                end do;
            end if;
        fi;
    end do:
  • Mathematica
    nmax = 10^50; ymax = 100; instances = 10; fi[y_] := n /. FindInstance[0 <= n <= nmax && x > 0 && n^2 + 1 == x^2*y^3, {n, x}, Integers, instances]; yy = Select[Range[1, ymax, 2], !IntegerQ[Sqrt[#]] && OddQ[ Length[ ContinuedFraction[Sqrt[#]][[2]]]]&]; Join[{0}, fi /@ yy // Flatten // Union // Most] (* Jean-François Alcover, Jul 12 2017 *)
  • PARI
    is(n)=ispowerful(n^2+1) \\ Charles R Greathouse IV, Nov 16 2012

Formula

m(1)=682, x(1) = 61 and m(2k+1) + x(2k+1)*sqrt(125) = (m(1) + x(1)*sqrt(125))^(2k+1) m(2k+1) = C(2k+1,0) * m(1)^(2k+1) + C(2k+1,2)*m(1)^(2k-1)*x(1)^2 + ...

Extensions

Added condition that x and y must be positive. Added missing initial term 0. Added warning that b-file has not been proved to be correct - there could be missing entries. - N. J. A. Sloane, Nov 17 2012
Showing 1-7 of 7 results.