How efficient can a factoring method using only GCD calculations be?

89 Views Asked by At

This post was inspired by the following one.
Fast way to check if two integers don't have any prime factors in common

We consider the sequence of numbers of equal $(p+q)$ for a number $N=pq$. We consider only odd composite numbers. We consider the example of $N=5*7=35=1*35$. The sequence of numbers of equal $(p+q)=1+35=36$ is given by $$35,68,99,128,155,180,203,224,243,260,275,288,299,308,315,320,323,324$$

There is another sequence of numbers of equal $(p+q)=5+7$ for $N=35$ but in this case we do not know the other numbers with the same $(p+q)$ unless we factor $N=35$. So we do not consider this sequence.

In the first sequence given above, we know that there are numbers with a common factor with $N=35$ every time we hit a multiple of $5$ or $7$. To find them, we need to take the $GCD$ of $N$ and those numbers with a common factor. Because we don't know which number has a common factor with $N$, we need to take the $GCD$ with $N=35$ of every number. This method cannot be efficient. However, I noticed that there are numbers with a common factor with $N$ but also with the same sum of digits ($SD=8$). For the example above these numbers are given by $$224,260,323$$

So we only need to check $3$ numbers out of $17$. Of these $3$ numbers only $224$ and $260$ have a common factor with $N=35$.

When experimenting with the method, I always found numbers with the same sum of digits and also found at least one with a common factor.
We know that the sum of digit is periodic within the sequence of numbers with the same $(p+q)$ so we only need to calculate those numbers and check if they have a common factor with $N$.

The question is this: Can it be proven that there is always at least one number (with the same sum of digits as $N$) within the sequence with a common factor with $N$?