I invented a recursive sequence below nearly 10 years ago, which assigns unity to every non-prime number and also gives all prime numbers. Do you think it is useful?!
Starting with $a_0=2$, we have:
$$a_{m+1}=2\prod_{i=0}^m(3+i)a_{m-i}^{-\sum_{k=1}^{3+m}\left\lfloor(3+m)a_{m-i}^{-k}\right\rfloor}$$
As pointed out by @MattiP., We indeed get:
$$2, 3, 1, 5, 1, 7, 1, 1, 1, 11, 1, 13, 1, 1, 1, 17,…$$
NOTE: There is a virtue about this recursive formula because, using a proper computer program, we can simplify the numerator and denominator of the produced fractions (for great values of $m$) before dividing/multiplying them by each other.
UPDATE: I also found the following recursive sequence in my old article. However, can anybody please verify its correctness using a computer program?!
$$a_{m+1}=\frac{m^2}{2}+\frac{7m}{2}+6-\sum_{i_m=0}^{(m+3)\operatorname{sgn}(a_m)}\space ... \space \sum_{i_1=0}^{(m+3)\operatorname{sgn}(a_1)}\space\sum_{i_0=0}^{(m+3)\operatorname{sgn}(a_0)}\left ( f(a_k,i_k,m)\operatorname{sgn}\left (\left\lfloor{\frac{m+3}{f(a_k,i_k,m)}}\right\rfloor\right )\right )$$
where
$$f(a_k,i_k,m)=\prod_{k=0}^{m}\left ( a_k+1-\operatorname{sgn}(a_k)\right )^{i_k}$$ The number of "sums" depends on $m$. Starting with $a_0=2$, it turns out that the sequence yields:
$$2, 3, 0, 5, 0, 7, 0, 0, 0, 11, 0, 13, 0, 0, 0, 17,…$$