2
$\begingroup$

how can I define my own list in which I have all primes less than x?

$\endgroup$
4
$\begingroup$

As Artes said in his comment:

Prime @ Range @ PrimePi @ x. See e.g. this question What is so special about Prime? to get an idea about possible limitations of this approach.

Application of what is being said:

primeInf[x_] := Prime @ Range @ PrimePi @ x
primeInf@20
{2, 3, 5, 7, 11, 13, 17, 19}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.