Tag Info

New answers tagged


I prefer Jens' solution but here is another simple formation: z1[n_] := Select[Range[n], CoprimeQ[#, n] &] And one for just for fun: z2[n_] := Join @@ Position[Range[n]/n, _[_, n]]


There is a simpler function instead of GCD that allows you to skip the comparison with 1: CoprimeQ. Using it, we can do this: Z[n_] := With[{i = Range[n]}, Pick[i, CoprimeQ[i, n]]] Z[21] (* ==> {1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20} *) Here I deliberately tried to avoid any cryptic symbols (although perhaps that should be par for the course in a ...


Root[{f, approx}] format was meant for representing roots of non-polynomial functions. Mathematica will never produce algebraic numbers (of degree <= $MaxRootDegree) represented in this way. If you manually enter Root[{f, approx}] with a polynomial f and a correct approximation the result is a valid exact number, but it is not recognized as an algebraic ...


I do not know what is going awry and have sent a question to the relevant person here. I can suggest an alternative route. Form the Root objects using say Solve, figure out which are the ones you want, and use those. p1 = x^5 + 6*x^4 - 42*x^3 - 142*x^2 + 467*x + 422; p2 = Expand[p1 /. {x -> ((x - 1)^2)}]; rts = RootReduce[x /. Solve[p2 == 0, x]]; N[rts] ...

Top 50 recent answers are included