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-6 of 6 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

A082393 Let p = n-th prime of the form 4k+1, take the integer solution (x,y) to the Pellian equation x^2 - p*y^2 = 1 with the smallest y >= 1; sequence gives value of y.

Original entry on oeis.org

4, 180, 8, 1820, 12, 320, 9100, 226153980, 267000, 53000, 6377352, 20, 15140424455100, 113296, 519712, 2113761020, 3726964292220, 190060, 183567298683461940, 448036604040, 28, 386460, 70255304, 649641205044600
Offset: 1

Views

Author

Cino Hilliard, Apr 14 2003

Keywords

Examples

			For n = 1, p = 5, x=9, y=4 since 9^2 = 5*4^2 + 1, so a(1) = 4.
		

References

  • C. Stanley Ogilvy, Tomorrow's Math, 1972, p. 119.

Crossrefs

Values of x are in A081232. Cf. A082394, A081233, A081234. Equals A002349(p).

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]}]; t = {}; Last /@ PellSolve /@ Select[Prime@Range@54, Mod[ #, 4] == 1 &] (* Robert G. Wilson v, Feb 28 2006 *)
  • PARI
    p4xp1(n,m) = { forstep(p=1,m,4, for(y=1,n, if(isprime(p), x=y*y*p+1; if(issquare(x), print1(y" "); break; ) ) ) ) }

Extensions

More terms from Robert G. Wilson v, Feb 28 2006

A081230 a(n) is the Levenshtein distance between n and n^n (where each is treated as a string).

Original entry on oeis.org

0, 1, 2, 3, 3, 4, 6, 8, 8, 9, 10, 11, 13, 16, 17, 18, 19, 22, 23, 26, 26, 28, 30, 32, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 86, 88, 90, 92, 94, 96, 99, 101, 103, 105, 107, 110, 112, 114, 116, 119, 121, 123, 125
Offset: 1

Views

Author

Francois Jooste (pin(AT)myway.com), Mar 11 2003

Keywords

Examples

			a(9)=8 since we can transform 9 into 9^9=387420489 by 8 insertions, namely inserting 3,8,7,4,2,0,4 and 8 in front of 9. a(2)=1 since we can transform 2 into 2^2=4 by one substitution, namely 4 for 2.
		

Crossrefs

Programs

  • Mathematica
    levenshtein[s_List, t_List] := Module[{d, n = Length@s, m = Length@t}, Which[s === t, 0, n == 0, m, m == 0, n, s != t, d = Table[0, {m + 1}, {n + 1}]; d[[1, Range[n + 1]]] = Range[0, n]; d[[Range[m + 1], 1]] = Range[0, m]; Do[ d[[j + 1, i + 1]] = Min[d[[j, i + 1]] + 1, d[[j + 1, i]] + 1, d[[j, i]] + If[ s[[i]] === t[[j]], 0, 1]], {j, m}, {i, n}]; d[[ -1, -1]] ]];
    f[n_] := levenshtein[IntegerDigits[n], IntegerDigits[n^n]]; Array[f, 69] (* Robert G. Wilson v *)

Extensions

Corrected by Robert G. Wilson v, Jan 25 2006

A081234 Let p = n-th prime, take smallest solution (x,y) to the Pellian equation x^2 - p*y^2 = 1 with x and y >= 1; sequence gives value of y.

Original entry on oeis.org

2, 1, 4, 3, 3, 180, 8, 39, 5, 1820, 273, 12, 320, 531, 7, 9100, 69, 226153980, 5967, 413, 267000, 9, 9, 53000, 6377352, 20, 22419, 93, 15140424455100, 113296, 419775, 927, 519712, 6578829, 2113761020, 140634693, 3726964292220, 5019135, 13, 190060
Offset: 1

Views

Author

N. J. A. Sloane, Apr 18 2003

Keywords

Crossrefs

Values of x are in A081233. Equals A002349(p). Cf. A082393.

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]}]; Table[ PellSolve[ Prime[n]][[2]], {n, 40}] (* Robert G. Wilson v, Jul 22 2005 *)

Extensions

More terms (a(8) - a(40)) from Robert G. Wilson v, Jul 22 2005

A081232 Let p = n-th prime of the form 4k+1, take smallest solution (x,y) to the Pellian equation x^2 - p*y^2 = 1 with x and y >= 1; sequence gives value of x.

Original entry on oeis.org

9, 649, 33, 9801, 73, 2049, 66249, 1766319049, 2281249, 500001, 62809633, 201, 158070671986249, 1204353, 6083073, 25801741449, 46698728731849, 2499849, 2469645423824185801, 6224323426849, 393, 5848201, 1072400673
Offset: 1

Views

Author

N. J. A. Sloane, Apr 18 2003

Keywords

Examples

			For n = 1, p = 5, x=9, y=4 since 9^2 = 5*4^2 + 1, so a(1) = 9.
		

Crossrefs

Values of y are in A082393. Cf. A082394, A081233. Equals A002350(p).

Programs

  • Mathematica
    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]}]; First /@ PellSolve /@ Select[Prime@Range@54, Mod[ #, 4] == 1 &] (* Robert G. Wilson v *)

Extensions

More terms from Robert G. Wilson v, Feb 28 2006

A173202 Solutions y of the Mordell equation y^2 = x^3 - 3a^2 + 1 for a = 0,1,2, ... (solutions x are given by the sequence A000466).

Original entry on oeis.org

0, 5, 58, 207, 500, 985, 1710, 2723, 4072, 5805, 7970, 10615, 13788, 17537, 21910, 26955, 32720, 39253, 46602, 54815, 63940, 74025, 85118, 97267, 110520, 124925, 140530, 157383, 175532, 195025, 215910, 238235, 262048, 287397, 314330, 342895
Offset: 1

Views

Author

Michel Lagneau, Feb 12 2010

Keywords

Comments

For many values of k for the equation y^2 = x^3 + k, all the solutions are known. For example, we have solutions for k=-2: (x,y) = (3,-5) and (3,5). A complete resolution for all integers k is unknown. Theorem: Let k be < -1, free of square factors, with k == 2 or 3 (mod 4). Suppose that the number of classes h(Q(sqrt(k))) is not divisible by 3. Then the equation y^2 = x^3 + k admits integer solutions if and only if k = 1 - 3a^2 or 1 - 3a^2 where a is an integer. In this case, the solutions are x = a^2 - k, y = a(a^2 + 3k) or -a(a^2 + 3k) (the first reference gives the proof of this theorem). With k = -1 - 3a^2, we obtain the solutions x = 4a^2 + 1, y = a(8a^2 + 3) or -a(8a^2 + 3). For the case k = 1 - 3a^2, we obtain the solution x = 4a^2 - 1 given by the sequence A000466.

Examples

			With a=3, x = 35 and y = 207, and then 207^2 = 35^2 - 26.
		

References

  • T. Apostol, Introduction to Analytic Number Theory, Springer, 1976
  • D. Duverney, Theorie des nombres (2e edition), Dunod, 2007, p.151

Crossrefs

Diophantine equations: see also Pellian equation: (A081233, A081234), (A081231, A082394), (A081232, A082393); Mordell equation: A053755, A173200; Diophantine equations: A006452, A006451, A006454.

Programs

  • Magma
    I:=[0, 5, 58, 207]; [n le 4 select I[n] else 4*Self(n-1)-6*Self(n-2)+4*Self(n-3)-Self(n-4): n in [1..40]]; // Vincenzo Librandi, Jul 02 2012
  • Maple
    for a from 0 to 100 do : z := evalf(a*(8*a^2 - 3)) : print (z) :od :
  • Mathematica
    CoefficientList[Series[x*(5+38*x+5*x^2)/(1-x)^4,{x,0,40}],x] (* Vincenzo Librandi, Jul 02 2012 *)
    CoefficientList[Series[E^x (5 x + 24 x^2 + 8 x^3), {x, 0, 40}], x]*Table[n!, {n, 0, 40}] (* Stefano Spezia, Dec 04 2018 *)

Formula

y = a*(8*a^2 - 3).
a(n) = sqrt(A000466(n)^3 - A080663(n)). - Artur Jasinski, Nov 26 2011
From Colin Barker, Apr 26 2012: (Start)
a(n) = 8*n^3 - 24*n^2 + 21*n - 5.
G.f.: x^2*(5 + 38*x + 5*x^2)/(1 - x)^4. (End)
a(n) = 4*a(n-1) - 6*a(n-2) + 4*a(n-3) - a(n-4). - Vincenzo Librandi, Jul 02 2012
E.g.f.: exp(x)*(5*x + 24*x^2 + 8*x^3). - Stefano Spezia, Dec 04 2018
Showing 1-6 of 6 results.