1

I am trying to pass some time during the COVID-19 era. I was going through my mails and found a problem. A friend of mine said her daughter had this problem in some math contest about 2-3 years ago and if I could solve it.

So find all prime numbers that divide the polynomials $n^2 + 1$ and $( n + 3 )^2 + 1.$

Now I ran it through a python program and found that the answer is $n = 5$, and the prime number is 13 and this seems to be the only answer!

I have tried to look for an analytical solution but to be honest, got nowhere :( Any help would be appreciated, thank you. And stay safe.

Bill Dubuque
  • 282,220
  • What do you mean by "prime number divides the two polynomials"? I dont think there are enough constraints –  Apr 17 '20 at 08:46
  • The gcd can be mechanically computed by the fraction-free Euclidean algorithm in the dupe

    $(n^2!+!1,n^2!+!6n!+!10)=(n^2!+!1,3(2n!+!3)) = $ $ (n^2!+!1,2n!+!3) = ((2n)^2!+!4,2n!+!3) = $ $ (13,2n!+!3) = (13,2(n!-!5))=(13,n!-!5).\ $ So $,p\mid 13,n-5,,$ so $,p = 13,, n = 5+13k.\ \ $

    – Bill Dubuque May 24 '24 at 19:18

2 Answers2

7

Let $p$ be a prime number which divides both polynomials. Since $p \mid n^2 + 1$ and $p \mid (n+3)^2 + 1 = n^2 + 6n + 10$, we also have

$$p \mid (n^2 + 6n + 10) - (n^2 + 1) = 6n + 9 = 3(2n + 3) \tag{1}\label{eq1A}$$

By Euclid's lemma, you have $p \mid 3 \implies p = 3$, or $p \mid 2n + 3$. For the first case, since all perfect squares have a remainder of either $0$ or $1$ when divided by $3$, then $n^2 + 1$ has a remainder of $1$ or $2$ and, thus, $3$ doesn't divide it. This means it must be the second case instead, i.e.,

$$p \mid 2n + 3 \;\;\to\;\; p \mid (2n + 3)^2 = 4n^2 + 12n + 9 \tag{2}\label{eq2A}$$

Also, we get

$$p \mid (4n^2 + 12n + 9) - 4(n^2 + 1) = 12n + 5 \tag{3}\label{eq3A}$$

Finally, we have from the first part of \eqref{eq2A}, along with \eqref{eq3A},

$$p \mid 6(2n + 3) - (12n + 5) = 13 \tag{4}\label{eq4A}$$

This shows that $p = 13$ is the only prime number which can divide both polynomials, with the first part of \eqref{eq2A} giving $2n + 3 = 13 \;\to\; n = 5$ being where this occurs for the first time for a positive integer $n$.

John Omielan
  • 52,653
  • ty John. Unnecessary detail. Just wanted a hint :) didnt expect the answer... thanks a lot – Alex Ainsworth Apr 17 '20 at 15:49
  • @AlexAinsworth You're welcome, and sorry about providing more detail than you wanted. I didn't realize you only wanted just a hint. – John Omielan Apr 17 '20 at 18:21
  • @Alex The method in this answer is a special case of a fraction-free form of the Euclidean gcd algorithm - see the linked dupe. Using that algorithm makes problems like these become simple rote mechanical computations requiring no insight, cf. my comment on the question. – Bill Dubuque May 24 '24 at 19:24
1

I'll give a slightly different approach.

Note first that $p=2$ is easily ruled out, so $p$ is odd. $p$ dividing both polynomials is equivalent to $$ n^2 \equiv (n+3)^2 \equiv -1 \pmod p $$ If $x^2 \equiv -1 \pmod p$ has a solution, then there are exactly two solutions, which are of the form $\pm x$. This is true because $p$ is prime. Therefore $n \equiv \pm (n+3) \pmod p$. If $n \equiv n+3$ then $p=3$, but there is no solution to $n^2 \equiv -1\pmod 3$. So: $$ n+3 \equiv -n \iff 2n \equiv -3 \iff n \equiv \frac{p-3}{2} \pmod p $$ Thus: $$ n^2 \equiv -1 \iff -4 \equiv 4n^2 \equiv 9 \pmod p \iff p\mid 13 \iff p=13 $$ So $p=13$ is the only candidate. We must simply check if $n = (13-3)/2 = 5$ satisfies $5^2 \equiv -1 \pmod {13}$. It does! So the full solution set is: $$ p=13,\quad n = 5 + 13k\ \textrm{ for }\ k\in\mathbb Z $$

Milten
  • 7,722
  • ty Milten. Yes an alternative approach. – Alex Ainsworth Apr 17 '20 at 15:49
  • Np :) I see you were only looking for hints, sorry about that. You should have said so in the post, many people here are happy to give hints – Milten Apr 17 '20 at 16:04
  • 1
    Lol np...Nothing wrong in giving a full answer :) But for @John Omielan answer for example suggesting Euclids Lemma would have been enough :) i had got to the p | 3(2n+3) just didnt grok the next step – Alex Ainsworth Apr 19 '20 at 09:27