Suppose I want all two digit primes between -75 and 100 inclusive.
a=Range[-75,100]
Select[Select[Cases[a, ?_Positive],(#>9&)],PrimeQ]
does it, but can't be the simplest way.
Cases[ a, _?Positive] and Cases[a, _?PrimeQ]
individually work but
Cases[a, _? Positive && PrimeQ]
fails, as do most of the variants I could think of using parenthesis and _?
in from of both Positive
and PrimeQ
Is there an elegant expression and is it possible to use logical operators with Cases
in the way I am attempting?
Select[Range[-75, 100], (Positive[#] && PrimeQ[#] &)]
$\endgroup$Select[]
is really much more preferable toCases[]
in this case. $\endgroup$