3
$\begingroup$

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:

sketch

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]][[1]];
While[! MemberQ[cycleList, h], {AppendTo[cycleList, h], h = 
Last[FactorInteger[2*h + 1]][[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!

$\endgroup$
3
$\begingroup$

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

data = primeCycle /@ Prime[Range[100]];

Graph[
 DirectedEdge @@@ Union @@ Map[Partition[#, 2, 1] &, data],
 VertexLabels -> "Name",
 ImageSize -> Large
 ]

enter image description here

$\endgroup$
  • $\begingroup$ Beautiful, thank you. $\endgroup$ – Robbie Apr 28 '18 at 22:22
  • 1
    $\begingroup$ You're welcome! $\endgroup$ – Henrik Schumacher Apr 28 '18 at 22:22
  • $\begingroup$ 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. $\endgroup$ – Robbie Apr 28 '18 at 22:26
  • 1
    $\begingroup$ Good point. It should read `VertexLabels -> "Name". (Fixed it also in the post). $\endgroup$ – Henrik Schumacher Apr 28 '18 at 22:29
  • 1
    $\begingroup$ Yeah, testing conjectures this way is a very mature approach. It's good to hear that you put this to good use! $\endgroup$ – Henrik Schumacher Apr 28 '18 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.