I'm trying to create a diagram that could be used to visualize the Collatz Conjecture in a new way, but I can't get Manipulate to work in the way I want it to. The goal of the program is to have m points in a circle, and be able to choose a starting point t, and go around the circle as defined by the Collatz conjecture, (i.e. if t is even to move to the point t/2 and if t is odd move to the point 3*t+1) but to move around the circle mod m.
Here is the code that I have right now.
g = Manipulate[
u = {};
n = 0;
While [t != 1,
If[Mod[t, 2] == 0 && t < 1000, t = (t/2); n = n + 1;
AppendTo[u, n]; Print[u] , t = 3 t + 1; n = n + 1;
AppendTo[u, n]; Print[u], Break]]
p = Table[{{-Cos[nos *(2 Pi/m)],
Sin[nos *(2 Pi/m)]}, {-Cos[N[Mod[Part[u, nos], m]] *(2 Pi/m)],
Sin[N[Mod[Part[u, nos], m]] *(2 Pi/m)]}}, {nos, 1, Length[u],
1}];
q = Table[{-Cos[nos *(2 Pi/m)], Sin[nos *(2 Pi/m)]}, {nos, 0, m - 1,
1}];
r = Table[
Text[Style[ToString@ nos, Medium], q[[nos + 1]] 1.1], {nos, 0,
m - 1, 1}];
Graphics[{{White, Circle[{0, 0}, 1.3]}, {Thickness[.0015],
Line[p]}, {Thickness[.0015], Line[s]}, {Hue[0], PointSize[.005],
Point[q]}, {Brown, r}
}, ImageSize -> {600, 600}], {m, 10, 500, 1}, {t, 2, 100, 1}]
as of right now though, the program just says "running" but never produces the image with the option of manipulating.
Any tips or advice would be really helpful! I'm brand new to using Mathematica.