Nothing Special   »   [go: up one dir, main page]

login
Revision History for A002349 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
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.
(history; published version)
#74 by Robert C. Lyons at Tue Feb 11 14:06:18 EST 2025
STATUS

proposed

approved

#73 by Chai Wah Wu at Tue Feb 11 13:00:40 EST 2025
STATUS

editing

proposed

#72 by Chai Wah Wu at Tue Feb 11 13:00:36 EST 2025
PROG

(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

STATUS

approved

editing

#71 by Joerg Arndt at Sat Oct 28 11:25:06 EDT 2023
STATUS

reviewed

approved

#70 by Michel Marcus at Sat Oct 28 11:20:34 EDT 2023
STATUS

proposed

reviewed

#69 by Jon E. Schoenfield at Sat Oct 28 11:08:51 EDT 2023
STATUS

editing

proposed

#68 by Jon E. Schoenfield at Sat Oct 28 11:08:48 EDT 2023
LINKS

T. D. Noe and Ray Chandler, <a href="/A002349/b002349.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)

STATUS

approved

editing

#67 by Joerg Arndt at Tue Sep 28 05:39:40 EDT 2021
LINKS

Eric Chen, T. D. Noe and Ray Chandler, <a href="/A002349/b002349_2.txt">Table of n, a(n) for n = 1..2500010000</a> (first 1000 terms 1..1000 from T. D. Noe, terms 1001...10000 from Ray Chandler)

Eric Chen, <a href="/A002349/a002349.txt">Smallest solution of y >= 1 for x^2 - n*y^2 = 0, +-1, +-2, +-3, +-4, if exists, for n <= 25000</a> (solutions for the same n are sorted by y, but if the x^2 - n*y^2 = +-4 solutions are not primitive (i.e., they are the double of the (x, y) for x^2 - n*y^2 = +-1), they are in back of other solutions).

Eric Chen, <a href="/A002349/a002349_2.txt">PARI/GP program for the smallest solutions of y >= 1 for x^2 - n*y^2 = 0, +-1, +-2, +-3, +-4</a> (type "solvepell(n)" to get the solutions, the format of the solutions are "[x, y, z]" for x^2 - n*y^2 = z; solutions for the same n are sorted by y, but if the x^2 - n*y^2 = +-4 solutions are not primitive (i.e., they are the double of the (x, y) for x^2 - n*y^2 = +-1), they are in back of other solutions).

Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PellEquation.html">Pell equation</a>

<a href="http://www.jakebakermaths.org.uk/maths/jshtmlpellsolverbigintegerv10.html">Pell equation solver for x^2-d*y^2 = 1</a>

<a href="http://math.fau.edu/richman/pell-m.htm">Pell equation solver for x^2-d*y^2 = 1</a>

<a href="http://www.numbertheory.org/php/pell.html">Pell equation solver for x^2-d*y^2 = +-1, +-2, +-3, +-4</a>

EXAMPLE

For n = 1, 2, 3, 4, 5, 6, 7, 8 the smallest solutions are (x,y) = (1, 0), (3, 2), (2, 1), (1, 0), (9, 4), (5, 2), (8, 3), (3, 1).

For n = 13 the smallest solution is (x,y) = (649, 180).

For n = 61 the smallest solution is (x,y) = (1766319049, 226153980).

For n = 92 the smallest solution is (x,y) = (1151, 120).

For n = 313 the smallest solution is (x,y) = (32188120829134849, 1819380158564160) (this is the equation which Bernard Frénicle de Bessy challenged John Wallis to solve).

For n = 991 the smallest solution is (x,y) = (379516400906811930638014896080, 12055735790331359447442538767).

For n = 4729494 the smallest solution is (109931986732829734979866232821433543901088049, 50549485234315033074477819735540408986340) (this is related to Archimedes's cattle problem).

PROG

(PARI)

pell(d)=

{

local(bb, b, len, m, x, y, z, x2, y2);

default(realprecision, 2000);

bb=contfrac(sqrt(d));

len=length(bb);

for(i=1, len,

b=vecextract(bb, 2^i-1);

m=contfracpnqn(b);

x=m[1, 1];

y=m[2, 1];

z=x^2-d*y^2;

if(z==1,

return([x, y])

);

if(z==-1,

x2=x*x+d*y*y;

y2=2*x*y;

return([x2, y2])

)

);

return([])

}

a(n)=if(issquare(n), 0, pell(n)[2]) \\ Eric Chen, Sep 27 2021

CROSSREFS

Cf. A002350 (values of x), A006702, A006703, A006704, A006705. See A033316, A033315, A033319 for records.

Cf. A033313, A033317 (square n's omitted).

Cf. A006702, A006703 (for x^2 - y^2 = +-1).

Cf. A077232, A077233 (for x^2 - y^2 = +-1, square n's omitted).

Cf. A006704, A006705 (for x^2 - y^2 = +-1, +-4).

Cf. A130226, A130227 (for x^2 - y^2 = -1).

Cf. A261247, A261248 (for x^2 - y^2 = 2).

Cf. A031396 (x^2 - y^2 = -1 is solvable).

Cf. A261246 (x^2 - y^2 = 2 is solvable).

Cf. A033316 (values d such that the smallest solution of x and y sets records).

Cf. A033315, A033319 (records for x and y).

Cf. A033314, A033318 (smallest value d such that the smallest solution of x and y is n).

KEYWORD

nonn,nice,easy,changed

STATUS

editing

approved

#66 by Eric Chen at Mon Sep 27 03:58:33 EDT 2021
LINKS

<a href="http://www.jakebakermaths.org.uk/maths/jshtmlpellsolverbigintegerv10.html">Pell equation solver for x^2-d*y^2 = 1</a>

<a href="http://math.fau.edu/richman/pell-m.htm">Pell equation solver for x^2-d*y^2 = 1</a>

<a href="http://www.numbertheory.org/php/pell.html">Pell equation solver for x^2-d*y^2 = +-1, +-2, +-3, +-4</a>

STATUS

proposed

editing

Discussion
Mon Sep 27
03:59
Eric Chen: Sorry, you can delete invasive edits, but you should not delete my PARI/GP program, it is useful.
04:00
Eric Chen: @Joerg, you want me to delete the crossrefs? But I think that these crossrefs all about Pell equations, they are all useful.
22:17
Eric Chen: I don't know the author of the three links of Pell equation solvers
22:18
Eric Chen: I also have b-files (also with 25000 terms) of A002350, A033313, A033317, A006702, A006703, A077232, A077233, A130226, A130227
22:20
Eric Chen: I have a PARI/GP code for A031396 (after the PARI/GP code for this sequence, if the first solution of x^2-n*y^2 = +-1 is +1, then x^2-n*y^2 = -1 is unsolvable):

pell(d)=

{

  local(bb, b, len, m, x, y, z, x2, y2);

  default(realprecision, 2000);

  bb=contfrac(sqrt(d));

  len=length(bb);

  for(i=1, len,

      b=vecextract(bb, 2^i-1);

      m=contfracpnqn(b);

      x=m[1, 1];

      y=m[2, 1];

      z=x^2-d*y^2;

      if(z==1,

         return(0)

      );

      if(z==-1,

         return(1)

      )

  );

  return([])

}
#65 by Jon E. Schoenfield at Mon Sep 27 00:53:37 EDT 2021
STATUS

editing

proposed

Discussion
Mon Sep 27
03:42
Joerg Arndt: "Pell equation solver for x^2-y^2 = 1" is not correct; in general you should not make massively invasive edits as you have done several times in a row now.
03:44
Joerg Arndt: More problems... Suggest to revert.