11

Find all primes $p$ such that $ p^3-4p+9 $ is a perfect square.

I tried a few different values for $p$, namely $2,3,5,7,$ and $11$. The prime $p =2,7,11$ all worked but $p =13$ didn't so it makes me wonder. How can I find all primes such that it is a perfect square?

EDIT: it turns out this is problem P25 in post number #63 at http://artofproblemsolving.com/community/c3h1171106p5665470

Will Jagy
  • 139,541
John Ryan
  • 1,269
  • 5
    If $p^3-4p+9 = n^2$ then $p^3-4p = n^2-9$, i.e. $(p-2)p(p+2) = (n-3)(n+3)$. I'm not sure if this helps, but it might be a good place to start. – JimmyK4542 Dec 17 '15 at 21:53
  • 2
    A small beginning: $p^3-4p+9$ is always divisible by three. But it is divisible by nine only when $p\equiv\pm2\pmod9$. This rules out primes not satisfying that congruence. – Jyrki Lahtonen Dec 17 '15 at 21:54
  • @JyrkiLahtonen 2 sqrt 3; 7 sqrt 18; 11 sqrt 36; 646 sqrt 16419 – Will Jagy Dec 17 '15 at 22:02
  • 2
    Also sprach Mathematica: Those three are the only primes that work among the 10000 smallest primes. – Jyrki Lahtonen Dec 17 '15 at 22:02
  • 1
    That and $646$ are all $p$ values up to $10,000,000$ – Will Jagy Dec 17 '15 at 22:04
  • 1
    John, what is the source of the problem? – Will Jagy Dec 17 '15 at 22:04
  • 4
    @Myself , I like to check these things without restricting the variable to be prime. Sometimes that condition is a deliberate red herring to disguise the real techniques for dealing with the problem. – Will Jagy Dec 17 '15 at 22:08
  • 2
    If everything else fails, somebody somewhere can tell the integer points on the elliptic curve $$y^2=x^3-4x+9.$$ In other words, I am joining in Will Jagy's camp suspecting that primeness of $p$ may not be the key. The use of silicone is described in this MO answer. See also this thread in MSE. – Jyrki Lahtonen Dec 17 '15 at 22:14
  • @WillJagy A good point! Although I feel like this is a problem from contest mathematics, where the prime condition is necessary to have an elementary solution. (And the full problem would be easy prey for the wielder of mightier weapons from the realm of elliptic curves.) – Myself Dec 17 '15 at 22:15
  • @Myself right, I am fiddling with $p$ prime, there may be a trick. Nope, seems circular. People should identify the source – Will Jagy Dec 17 '15 at 22:17
  • @WillJagy I got this question from someone else but it was related to competition math. – John Ryan Dec 17 '15 at 22:24
  • 2
    Ok So I cheated a bit I asked Sage nicely for integral points, this is the list [(-2 : 3 : 1), (0 : 3 : 1), (2 : 3 : 1), (7 : 18 : 1), (11 : 36 : 1), (646 : 16419 : 1)]. So only 2, 7, 11, as expected... – Myself Dec 17 '15 at 22:26
  • @Myself, a neighbor recently installed Sage for me on my home computer; what would be the command(s) for this? – Will Jagy Dec 17 '15 at 22:29
  • It's: E = EllipticCurve([0,0,0,-4,9]); E.integral_points() (It is actually described by Sage developer William Stein in the link that Jyrki gave above.) – Myself Dec 17 '15 at 22:30
  • @Myself thank you; it works, and I can get detail from the link. I wrote to Stein at some point, he suggested an online calculator version. I couldn't get anywhere with that, and my neighbor from Finland is a sysadmin type. He installed it, and it was clear from what he had to go through on my machine that I would not have been able to do that myself, no matter who I had on telephone helping. – Will Jagy Dec 17 '15 at 22:37
  • @WillJagy I must solve this question without a computer. – John Ryan Dec 17 '15 at 22:38
  • @JohnRyan , you have not given us much reason to care. Nothing about your background, nothing of any importance about the problem. – Will Jagy Dec 17 '15 at 22:42
  • 1
    @WillJagy Have you given https://cloud.sagemath.com/ a chance? It is a lot better than the old notebook. – Myself Dec 17 '15 at 22:43
  • It was just a problem a friend gave me to solve it, so I didn't think it was going to be so hard. – John Ryan Dec 17 '15 at 22:44
  • @Myself, I just could not get it to work at all. Usually my friend Dmitry from grad school days helps me install things, guiding me by telephone. I can use the online calculator for Magma. Between them, I can get the full genus of a positive ternary quadratic form with integer coefficients, including spinor genera, and confirm with the mass formula on Sage. – Will Jagy Dec 17 '15 at 22:51
  • @JohnRyan , I see lots of questions here on MSE "given by friends." You never know how careful the friend was in describing the problem, and this way we have no idea what background ought to be used in solving the problem. Get your friend to tell you the answer, in any case the exact source of the problem. – Will Jagy Dec 17 '15 at 22:53
  • @WillJagy Here is the exact source of the problem: http://artofproblemsolving.com/community/u182287h1171106p5665470 – John Ryan Dec 17 '15 at 22:56
  • 3
    A related question: it seems that $m^4 + 24m +16$ is a square only when $m=3$ (I checked up to $m = 50000000$). Arrive at that by solving for $p$ in the equation $p^3 - 4p + 9 = (mp + 3)^2$ (there is also the case of $mp-3$ I suppose. – tkr Dec 17 '15 at 22:57
  • @JohnRyan Evidently P25 at the current end of that thread, by someone you have never met. – Will Jagy Dec 17 '15 at 23:04
  • @WillJagy-What you wanted to say is the following I am providing below: (i)For p=2,n=3 as 8-8+9=9,(ii)For p=7,n=18 as 343-28+9=324,and For p=646,n=16419 as 269586136-2584+9=269583561 –  Jun 11 '16 at 04:07

2 Answers2

17

If $p^3-4p+9=n^2$ then $n^2\equiv 9 \pmod{p}$ and $\pm n \equiv 3 \pmod{p}$ since $n^2-9\equiv 0$ can only have two roots modulo a prime.

By choosing the appropriate sign we can write $$ \begin{align} n^2=(-n)^2 &= (kp+3)^2 \\ p^3-4p+9 &= k^2p^2+6kp+9 \\ 0 &= p^2-k^2p-(6k+4) \\ p & = \frac{k^2\pm \sqrt{k^4+24k+16}}{2} \end{align} $$ where we used $p\ne 0$ since it's a prime. This can only have an integer solution for $p$ when $k^4+24k+16$ is a square (as @tkr suggested in the comments). But $$ \begin{array}{ll} (k^2-1)^2 = k^4-2k^2+1 < k^4+24k+16<(k^2)^2 & \text{if }k<-11 \\ (k^2)^2 < k^4+24k+16< k^4+2k^2+1 =(k^2+1)^2 & \text{if }k>12 \end{array} $$ so if $k<-11$ or $k>12$ then $k^4+24k+16$ lies between two squares and hence is not a square. This leaves 24 values to check, which you could do by hand. It leads to solutions when $k=-3,0,3$ which give integral values for $p$ of $-2,2,7,11$, of which only $2,7,11$ would normally be considered prime.

Zander
  • 10,948
  • 1
  • 26
  • 54
0

Zander's solution is nice, but there might be a way to reduce the number of cases to check. when $k\leq -6$ or $k\geq 7$
$(k^2-2)^2<k^4+24k+16<(k^2+2)^2$
but $k^4+24k+16=k^4,(k^2-1)^2,(k^2+1)^2$ don't have solutions. (compare parity for $(k^2-1)^2$ and $(k^2+1)^2$)
so $-5\leq k\leq 6$
also observe 3|k. if not, $k^4+24k+16\equiv 2\pmod3$ , which is not a square.
now $k\in\{-3,0,3,6\}$ , of which 3 out of the 4 cases yield solutions.

question is from turkey NMO 2009, 2nd round, q1: https://artofproblemsolving.com/community/c6h364542

cineel
  • 1,536