New answers tagged

1

Another method for the second question uses the Position function along with the _? (PatternTest) construct: list = Range[1, 20, 2] Transpose[{Flatten[Position[list, _?PrimeQ]], Select[list, PrimeQ]}] (* {{2, 3}, {3, 5}, {4, 7}, {6, 11}, {7, 13}, {9, 17}, {10, 19}} *)


3

For the first, here are two options (the second from BlacKow): Simplify[Mod[2*n + 2, 2], n ∈ Integers] Simplify[Divisible[2*n + 2, 2], n \[Element] Integers] (* 0 *) (* True *) means that 2*n + 2 is always even. Alternatively, checking a "few" cases: EvenQ[2 # + 2] & /@ Range[-200, 200, 2] // And @@ # & (* True *) For the second question (and ...



Top 50 recent answers are included