# Visualizing Prime cyclical data

I'm not too familiar with Mathematica graphics, but I would like to produce a "ring-list" with other lists point to a center list. Here is an example list of the many I've generated (each list is infinite, I think):

$$\left( \begin{array}{c} \{2,5,11,23,47,19,13,3,7\} \\ \{3,7,5,11,23,47,19,13\} \\ \{5,11,23,47,19,13,3,7\} \\ \{7,5,11,23,47,19,13,3\} \\ \{11,23,47,19,13,3,7,5\} \\ \{13,3,7,5,11,23,47,19\} \\ \{17,7,5,11,23,47,19,13,3\} \\ \{19,13,3,7,5,11,23,47\} \\ \{23,47,19,13,3,7,5,11\} \\ \{29,59,17,7,5,11,23,47,19,13,3\} \\ \end{array} \right)$$

*it won't let me put in the LaTeX because it appears as code.

As you can tell, there are duplicates in this list. The first list is the "root" cycle. I would like all of the other lists to point, respectively, to there belonging connection to this "root" list.

Here is the type of thing I'm envisioning: Pardon my poor paint skills (and lack of knowledge). If you're curious, I'm generating arithmetic prime sequences with the following algorithm:

primeCycle[x_] := Module[{},
cycleList = {};
h = x;
AppendTo[cycleList, h];
h = Last[FactorInteger[2*h + 1]][];
While[! MemberQ[cycleList, h], {AppendTo[cycleList, h], h =
Last[FactorInteger[2*h + 1]][];}];
cycleList
]


I plan on investigating more than $2\cdot h+1$, but I'm not able to compile enough data by hand. The hope is that maybe I learn something interesting.

I believe that for any function $A\cdot h \pm b$, ($A$ is prime and $b<(A-1)/2)$, there is always a "root" cycle (as depicted above).

I also think it may be interesting to investigate other functional forms, but I plan on sticking with simple functions for now.

Thanks!

You can cast your results into a directed graph as follows:

data = primeCycle /@ Prime[Range];

Graph[
DirectedEdge @@@ Union @@ Map[Partition[#, 2, 1] &, data],
VertexLabels -> "Name",
ImageSize -> Large
] • Beautiful, thank you. – Robbie Apr 28 '18 at 22:22
• You're welcome! – Henrik Schumacher Apr 28 '18 at 22:22
• How can I make the labels the values at that point instead of the index? (To make it identical to the drawing I made). Awesome, I should have figured it was "name" but I wasn't positive. – Robbie Apr 28 '18 at 22:26
• Good point. It should read `VertexLabels -> "Name". (Fixed it also in the post). – Henrik Schumacher Apr 28 '18 at 22:29
• Yeah, testing conjectures this way is a very mature approach. It's good to hear that you put this to good use! – Henrik Schumacher Apr 28 '18 at 22:36