i know there is a Command in Matematica to get prime number, but i want to break down the code,here is what i got
Clear[a, b, n] a=For[n = 2, n <= 19, If[Mod[n, 2] < 1 , , Print[n]], n++]; b=For[n = 2, n <= 19, If[Mod[n, 3] < 1 , , Print[n]], n++]; Slice[a, b] and the result is 3 5 7 9 11 13 15 17 19 4 5 7 8 10 11 13 14 16 17 19 20
i want to slice it but i dont know how i want the result be 5 7 11 13 17 19
Prime[Range[10]] == Rest[Cases[FactorInteger[Range[30]], x_?(Length[#] == 1 && #[[1, 2]] == 1 &) :> x[[1, 1]]]]$\endgroup$