Does this alternative way of calculating Twin Primes help to prove that there are an infinite number of Twin Primes?

113 Views Asked by At

I recently saw this video (https://www.youtube.com/watch?v=n4gmYjyI3vo) which explained a proof showing that all twin primes, when multiplied together, have a product where the digits of the product always add up to 8. Sort of like how numbers that are divisible by 3 will have their digits all add up to a 3, 6, or 9.

So I thought why not use that property of twin primes to make an algorithm to find them. And came up with this Mathematica code:

allDigitsThatAddUpTo[sumTarget_, numberOfDigitsInCalculator_] := 
Module[{i, digitsThatCanAddUpToSumTarget, list, digitList},
digitsThatCanAddUpToSumTarget = Flatten[
    Join[
    Table[0, numberOfDigitsInCalculator - 1],
    Table [
    Table[i, 
    If[sumTarget / i > numberOfDigitsInCalculator, 
        numberOfDigitsInCalculator, Floor[sumTarget / i]]], 
    {i, 1, 9, 1}]
    ]
    ];

list = Permutations[
    digitsThatCanAddUpToSumTarget, {numberOfDigitsInCalculator}];
    digitList = Select[list, Total@# == sumTarget &];

Map[FromDigits, digitList]
]
expandExponentsFromFactors[n_] := Module[{},
Table[n[[1]], n[[2]]]
]
primeFactors[n_] := Module[{},
Flatten[Map[expandExponentsFromFactors, FactorInteger[n]]]
]

twinPrimes[list_] := Module[{},
If[Length[list] == 2, If[list[[2]] - list[[1]] == 2, list, {}], {} ]
]

twinPrimeGrid[sumTarget_, numberOfDigitsInCalculator_] := 
Module[{sumees, factors, twins},
sumees = allDigitsThatAddUpTo[sumTarget, numberOfDigitsInCalculator];
factors = Map[primeFactors, sumees];
twins = Map[twinPrimes, factors];

Grid[{sumees, factors, twins}, ItemSize -> Full, Frame -> All]
]

So when you run this function: twinPrimeGrid[8, 2]

You will get a table that looks like this:

8 17 26 35 44 53 62 71 80
{2,2,2} {17} {2,13} {5,7} {2,2,11} {53} {2,31} {71} {2,2,2,2,5}
{} {} {} {5,7} {} {} {} {} {}

The first row shows all 2 digit numbers whose digits can be added together to equal 8.

The second row shows all of the prime factors.

The third row highlights the twin primes.

So to search for all of the twin primes, you need to run twinPrimeGrid[8, X] where X is the largest number you have patience to compute.

But, since 1 + 7 = 8 and 2 + 6 = 8 and so on, you also need to run twinPrimeGrid[17, X] and twinPrimeGrid[26, X] etc, to search for all of the twin primes.

Some interesting things I have noticed from playing with these calculations:

  • A twin prime will never have a product that ends in 0 2, 4, 5, 6, 8 so this removes a lot of columns from that table that you need to find the factors for to test for twin primes. You can also test for other divisibility rules but I think the last digit is much easier and cheaper to compute.

  • When I run twinPrimeGrid[8, X] and keep increasing X I find more twin primes. This is also true for running twinPrimeGrid[17, X] and twinPrimeGrid[26, X] etc.

So since there are an infinite amount of numbers that can add to 8, because 1 + 7 = 8, 1 + 0 + 7 = 8, 1 + 0 + 7 + 0 = 8 etc, the question is: is there a number that eventually adds up to 8 (using the method shown in the video) for which there is not a twin prime? My guess is that each possible digit combination that eventually adds to 8 will have a twin prime associated with it.

1

There are 1 best solutions below

1
On

That result is trivial: any pair of primes other than $(3,5)$ has the form $(3n-1,3n+1)$ because none of the primes is a multiple of 3. Hence the product of the primes is $$(3n-1)(3n+1)=9n^2-1\equiv-1\equiv8\mod9.$$ As an aside, $n$ must also be even because neither of the primes is even, thus the prime pair can be represented as $(6m-1,6m+1)$. So we have the stronger result $$(6m-1)(6m+1) = 36m^2-1 \equiv -1 \mod 36.$$

The fact that a natural number has the same remainder mod 9 like the sum of its digits follows from $10\equiv 1 \mod 9$:

$$n =\sum a_k10^k \equiv \sum a_k1^k \equiv \sum a_k = \operatorname{sum\_of\_digits}(n) \mod 9$$ where the $a_k$ are the decimal figures of $n$.

As far as the number of prime pairs is concerned, we have $$\text{There are infinitely many prime pairs} \implies \text{There are inifitely many natural numbers of the form } 3n$$ but the converse may be true or may be false.


That said I am wondering why they are blowing up trivial fact about prime(pair)s. The same is true for "Squaring Primes" https://www.youtube.com/watch?v=ZMkIiFs35HQ where they use the same obvious congruence relation for any prime greater than 3:

Any prime $p>3$ is of the form $p=6n\pm 1$ thus $$p^2=36n^2\pm12n+1 = 1 + 12n(3n\pm1)$$

Now $n(3n\pm1)$ is always even: Either $n$ is even and thus the whole term, or $n$ is odd and $3n\pm1$ is even. In any case we have that $p^2\equiv1\mod24$.


Thus, in either video, no actual properties of prime numbers are used, just the mere trivial fact that primes greater than 3 attain the form $6n\pm1$.