8424432925592889329288197322308900672459420460792433
September 1, 2020
Regular readers know of my affinity for number theory. Today’s exercise is a reflection of that.
It is conjectured that the two numbers produced by the equations n17 + 9 and (n + 1)17 + 9 for a given n are always co-prime (that is, their greatest common divisor is 1). Is that conjecture correct?
Your task is to either prove that the greatest common divisor is always 1 or write a program that finds a case where the greatest common divisor is not 1. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Here is my take on it using Julia: https://pastebin.com/AKTLZNee
Although it’s not solid proof, I checked n values up to 10 000 000 and couldn’t find an exception to this rule. However, there could be a case for higher values of n where the two values are not coprime. Cheers!
Here’s a C++ solution that conducts the search in parallel, using GMP for arbitrary-precision integers and OpenMP for multiprocessing.
Given how large the smallest counterexample is, starting the search from zero is practically ineffective.
When starting the search one billion numbers away, the counterexample is found after about 20 minutes on my 8 core (2 threads per core) processor. However, this approach would also be ineffective if I didn’t check the solution from @programmingpraxis, as I wouldn’t know where to start searching.
Example usage:
Another example:
(n^19 + 6) and (n+1)^16 + 9
n = 1578270389554680057141787800241971645032008710129107338825798
gcd = 5299875888670549565548724808121659894902032916925752559262837
[…] best widespread divisor isn’t 1. When you find yourself completed, you might be welcome to learn or run a prompt answer, or to submit your individual answer or focus on the train within the […]