1

How can i find all number $N$, where $N=p*q$. (Here, $p$ and $q$ are primes and $p<q$) ?

For example: I want a formula that help me to find all $N<1000$

  • 1
    $1000$ is very small, it should be easy to compute the exact result in that case "by hand" (i.e., using a computer). In general I do not believe you'll get anything like a closed formula. Some bounds and asymptotic behavior for the function can be found, e.g., here – lulu Feb 03 '20 at 21:25

2 Answers2

2

Apply the sieve of sundaram's logic, $$(2a+1)(2b+1)=2(2ab+a+b)+1$$ one of $a,b$ must less than 16, because if not $a=b$ gives $$4a^2+4a+1>1000$$ Then applying it again you'll need $c$ less than 3, because you can sieve out all values that would not create primes in the product. Finally you would double all primes less than 500.

1

For each prime $p < \sqrt{1000}$, you take $pq$ for each prime $q$ with $p < q < 1000/p$.

EDIT: As requested, here is some Matlab code.

A = tril(primes(500)' * primes(sqrt(1000)),-1);
sort(A(A > 0 & A < 1000)')
Robert Israel
  • 470,583