17

There is a related question on math.stackexchange, but this question here is different.

Let $n$ be a natural number ($n\in\mathbb{N}$). Calculate the value of this expression:

$$ m=\mathrm{gcd}(n^{17}+9,(n+1)^{17}+9) $$

Here $\mathrm{gcd}⁡(a,b)$ is the greatest common divisor of $a$ and $b$ with $a=n^{17}+9$ and $b=(n+1)^{17}+9$. The result of this expression is $m=1$ if $a$ and $b$ are coprime, and this is the case for any $n<n_0$ with

$$ n_0=8424432925592889329288197322308900672459420460792433 $$

which is a number with 52 decimal digits. If the value of $n$ is exactly this number, then the value of

$$ m=8936582237915716659950962253358945635793453256935559 $$

which is another number with 52 decimal digits. And of course you get the same result for any $n=n_0+k\cdot m$ where $k$ is any non-negative integer, which means that there are infinite many solutions to

$$ \mathrm{gcd}(n^{17}+9,(n+1)^{17}+9)\neq 1 $$

I did not study mathematics (this is why I have troubles understanding the answer to the linked question from above), but I am teaching computer science, and I used this expression to write this small Python program:

import math
# Initialization
n = 1
gcd = 1
# loop as long as gcd equals 1
while gcd == 1:
    n += 1
    gcd = math.gcd(n ** 17 + 9, (n + 1) ** 17 + 9)
# after the loop
print("n   =",n)
print("gcd =",gcd)
print("halting now")

I ask my students if this program will halt, and I ask them for suggestions of methods of how to answer this question. This turns out to be a good starting point to discuss Turing’s Halting problem. This program is well suited because it halts. But without knowing the correct answer in advance or understanding the math behind the problem, it is almost impossible to find the correct answer in a reasonable amount of time. (I can show that this program halts when I replace the first 1 with a value slightly below $n_0$.)

But last year, after a few minutes my students agreed on this answer: "Yes it will halt, because if it would run forever, you wouldn't have shown it to us." This is clever, but it takes away the motivation to suggest methods of figuring out whether or not it will halt.

So I want to give them a second program that is as similar as possible to the program shown here, but this second program should run forever. And there should be a proof that it can never halt. Then I would tell my students that exactly one of the two programs will halt, and I would ask them for methods to find out which of the two is the halting program.

And this brings me to my question:

Is there a combination of $a,b,c\in\mathbb{N}$ such that

$$ \forall n\in\mathbb{N}\left(\mathrm{gcd}(n^a+b,(n+c)^a+b)=1\right) $$ ?
An answer is preferred where $a,b,c$ are close to $17,9,1$. (Especially $c=1$ would be very fine.)


Addendum (reaction to a comment):
There are infinite many trivial solutions: $a=1; b\in\mathbb{N}; c=1$. But this is too simple. My students would quickly find out, that $\mathrm{gcd}(n^1+b,(n+1)^1+b)=\mathrm{gcd}(n+b,n+1+b)=1$ for all $n$ and for all $b$, and that a program with these trivial parameters would never halt.

Bill Dubuque
  • 272,048
  • What about $\gcd(n^{17}+1,(n+1)^{17}+1)=1$, for $b=1$? I have to check the resultant of the two polynomials in Gerry's answer for it. Are you allowing $b=0$? – Dietrich Burde Jan 03 '23 at 17:12
  • Ideally, you'd find some closed formula for the resultant in terms of $a,b,c$, and see if you can get it to equal $\pm 1$. – Mastrem Jan 03 '23 at 17:42
  • This is equivalent to the existence of polynomials $f,g\in\mathbb{Z}[X]$ satisfying $f\cdot (X^a+b)+g\cdot ((X+c)^a+b)=1$. – Mastrem Jan 03 '23 at 17:58
  • @DietrichBurde: Yes, $b=0$ is fine. Please tell me the result of your check. – Hubert Schölnast Jan 03 '23 at 18:28
  • @Mastrem: If your comment was addressed to me: I don't know what a resultant is. (As I said: I didn't study mathematics. I studied chemistry, physics, business informatics and information security.) – Hubert Schölnast Jan 03 '23 at 18:31
  • That number $m=89\dots$ comes naturally out of computing the solution to $p(x)q(x)+p(x+1)r(x)=1,$ for $q,r\in\mathbb Q[x]$ and finding the common denominators of $q,r$ are $m.$ So you get that the gcd must always be a divisor of that $m.$ Not sure how much that. Helps. – Thomas Andrews Jan 03 '23 at 19:14
  • 3
    I presume you are not very interested in the solution $a=c=1.$ – DanielWainfleet Jan 04 '23 at 01:43
  • 1
    @DanielWainfleet: You are right. No trivial solutions please. – Hubert Schölnast Jan 04 '23 at 10:04
  • This is a very interesting question, but is it really "elementary number theory"? I think this question is too hard to be considered "elementary". I also think that the tag "big numbers" may not be appropriate. – Alina Jan 08 '23 at 12:59
  • @Alina: You are right. I added the tag "number theory". But I still think that "big numbers" fit well. The description says, "... the fact that a number is very large has to affect the question." And this is the case here, at least as I see it. – Hubert Schölnast Jan 08 '23 at 14:46
  • 1
    Just FYI ... The OP's 52-digit example is among the cross-references at OEISA118119 (the largest one listed being for $(a,b,c)=(19,6,1),$ having 61 digits). – r.e.s. Jan 10 '23 at 01:44
  • 1
    Depending on what is considered "a reasonable amount of time", wouldn't the following simpler (Python) program serve your stated purpose?... c = 3; n = 1; while pow(2, n, n) != c: n += 1; With $c=3$ it doesn't halt until $n=4700063497;$ but if changed to $c=1$ then it never halts. Here $\text{pow}(2,n,n)$ is the nonnegative remainder when $2^n$ is divided by $n.$ (Some other values of $c$ are known to cause halting only after more than $10^{20}$ steps.) – r.e.s. Jan 10 '23 at 04:37
  • @r.e.s. Many thanks for your suggestion! In computer science, only a runtime significantly greater than the age of the universe is considered to be "not a reasonable time" because in a time span smaller than the age of the universe, it might be possible to build faster hardware and use massively parallel computing to speed things up so that these problems could become solvable in the lifetime of a human. I ran your program for 10 million cycles and it took 50 seconds to do that. From that ... – Hubert Schölnast Jan 10 '23 at 15:14
  • 1
    ... I can estimate that it will halt in less than 7 hours on my run-of-the-mill computer. This is what we computer scientists call "a reasonable time". All my students can start this program and wait for it to finish. I did the same thing with the program I presented in my question. It takes 335 seconds for 10 million cycles. So for all $8.4\cdot10^{51}$ cycles, it takes about $9\cdot10^{40}$ years. That is about $6.5\cdot10^{29}$ times the age of the universe. This duration is what we call "not a reasonable time". – Hubert Schölnast Jan 10 '23 at 15:15
  • It would seem, for immediate and elementary mathematical reasons, that $c=1$ is not only convenient but also necessary. Likewise, it is not unlikely that the problem does not admit of a non-trivial solution, as it would be, for example, $(a,b,c)=(1,1,1)$. – Piquito Jan 10 '23 at 17:14
  • 2
    In the light of r.e.s comment, it might be a good idea to post the "high-level" question separately (i.e. find a very simple problem in which tiny change of problem statement changes it from "yes-but-bruteforce-takes-unfeasibly-long" to "no"). I have some ideas for that problem myself but it feels wrong to put them as answers or comments to this one (which is very interesting on its own!). – Peter Košinár Jan 11 '23 at 14:49
  • @PeterKošinár: Thank you for your suggestion. Here is the "high-level" question. – Hubert Schölnast Jan 12 '23 at 10:02
  • 2
    This is a really intriguing question, and I was bummed to see that it didn't have an answer. As such, I added a small bounty, hopefully it will get the traction it deserves!! – Clyde Kertzer Feb 09 '23 at 22:24
  • Thank you very much, @ClydeKertzer – Hubert Schölnast Feb 10 '23 at 09:58
  • I do have an issue with how this is written. Well, technically you are not asking for any $a,b,c \in \mathbb{N}$ such that $n^a+b$,$(n+c)^a +b$, you are asking for nontrivial solutions, so your question as stated is not quite correct. You really do need to clarify what constitutes a nontrivial solution, and put this into your question [no take-aways in the addendum, please]. We do downvote questions that are substantially editted after the fact so I have to do so here. -1 – Mike Feb 13 '23 at 19:16
  • What if you used a currently unsolved problem, such as roughly: for n in range(4,inf,2): if all(not(prime(k) and prime(n-k)) for k in range(n)): exit() – Daniel Schepler Feb 23 '23 at 22:36

1 Answers1

1

Certainly $b=0$ and $c=1$ (one of OP's comments says that "$b=0$ is fine") is enough to guarantee this, regardless of the value of $a$: $$\gcd(n^a,(n+1)^a)=1$$ holds because any prime $p$ that divides $n^a$ also divides $n$, and hence $(n+1)^a \equiv 1$ (mod $p$). So $n^a$ and $(n+1)^a$ can't have any common prime factor.

On the other hand, based on the reasoning in the linked question, less trivial examples with $b\neq 0$ and $c=1$ can only be found when the resultant of $n^a+b$ and $(n+1)^a+b$ is equal to $\pm 1$ for some positive integer $b$. This doesn't happen for $a=2,3,4$; but it does seem worth checking for higher values of $a$, and that check could be automated.

mjqxxxx
  • 41,358
  • FWIW, with c=1, SageMath finds resultant(2,1)=5, and resultant(a,b) strictly increasing in each argument for a=2..100, b=1..1000. – r.e.s. Feb 14 '23 at 14:23