1
$\begingroup$

I need to find pairs of numbers A and B such that A-B=N for some constant N say 129. The restriction for A and B are that both numbers should have p number of prime factors each and no prime factor must occur twice in the same number. For instance, p could be 5.

I did write a program to do this iteratively starting from 1 and 130(129+1). However, for huge numbers, the time taken is just too long to be feasible. Is there a better approach for this?

As an example, consider the following- A could be 25806 and B could be 25935. Here, A will have 2 3 11 17 23 as it's factors and B will have 3 5 7 13 19 as it's factors. No factor repeats itself in the same number and both numbers have 5 factors each

$\endgroup$
3
  • $\begingroup$ Welcome to stackexchange. Please edit to clarify the question. If $A$ has $5$ prime factors then it will have a composite factor unless it is the $5$th power of a prime. Is that what you mean? If so, the you are looking for the difference of $p$th powers of primes. Can you tell us a few examples that show what you want? It might also help if we knew where the question comes from. $\endgroup$ Jul 4, 2019 at 12:48
  • $\begingroup$ Sorry about the 'composite factor' part. I have made the required edits $\endgroup$
    – Paddy
    Jul 4, 2019 at 12:55
  • $\begingroup$ You can use the expression "square free factors" $\endgroup$
    – Piquito
    Jul 4, 2019 at 13:37

1 Answer 1

1
$\begingroup$

Partial answer.

Let's look at the first case, when $p=1$. Then you are looking at the difference $a - b = N$ of primes.

If $N$ is odd then the prime $b$ must be even, so $b=2$. Then there is a unique solution for every $N$ which is $2$ less than a prime, and no solution otherwise.

If $N$ is even then the simplest case $N=2$ is unsolved, because it asks for pairs of twin primes. We don't know whether there are infinitely many, let alone how to find them.

The general problem is much much harder.

You can always start with two sets of primes, multiply each set together and subtract to find $N$ (as in your example), but starting from $N$ and asking for sets of primes is well beyond what's known.

$\endgroup$
2
  • $\begingroup$ That is really helpful, thanks :) $\endgroup$
    – Paddy
    Jul 4, 2019 at 13:34
  • $\begingroup$ You're welcome. You can accept the answer (check mark) or upvote (up arrow) or both. $\endgroup$ Jul 4, 2019 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .