Pattern for generating primes and semiprimes?

681 Views Asked by At

First, is there a formula that can generate semiprimes in polynomial time? Also, I found this interesting pattern: $$3x+1, 3x+2$$ Inputting increasing natural x spits out $$7, 11, 13, 17, 19, 23, 25, 29,...47, 49..$$ It looks like a series of primes and semiprimes? Any way to prove that?

2

There are 2 best solutions below

0
On BEST ANSWER

This is not actually just a sequence of primes and semi primes (I assume the sequence is $3n+1$ if $n$ is even and $3n+2$ if $n$ is odd).

The sequence first fails at $125$ since it is the smallest non prime or semiprime number which isn't divisible by $2$ or $3$. The sequence is exactly all positive integers (greater than $1$) which are equivalent to $1$ or $5$ modulo $6$.

In particular the sequence includes all non primes or semiprimes which do not have factors of $2$ or $3$.

0
On

Your formula works well for the first numbers, because the first odd number that is not prime or semiprime or multiple of three is $125=3\cdot 41+2$.