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