Generate a modulo rosace The cool stuff

The following rosace can help calculate numbers modulo 7.



In order to do that, you must start at 0 and turn clockwise a number of steps given by the first digit. Then, for each successive digit, follow the arrow and then turn clockwise the number of steps given by that digit.

Here is how you proceed for number 294:


You start at circle 0.
You turn clockwise the number of steps given by the first digit (which is a 2, you end up at 2).
You follow the arrow there (you end up at 6).
You turn clockwise the number of steps given by the second digit (which is a 9, you end up at 1).
You follow the arrow there (you end up at 3).
You turn clockwise the number of steps given by the third number (which is 4, you end up at 0).
294 mod 7 = 0 (meaning 294 is multiple of 7).


(Video explanation if you still didn't get it)

The goal

Figure out how that works (I know but I won't tell you).

Create a program that takes a number n in parameter and that generates a rosace for mod n.

The rosace can be displayed by any means you want (ASCII, generate PNG, generate SVG, ...) as long as it could be used by a 8 years old child (so no list of rules, I want a picture)!

You can use strait lines, even if it's a bit less clear than what I made for the example, but you must show clearly the numbers that point to themselves with some kind of tail-biting arrow.

Test cases

(I only give the links between the numbers, feel free to edit my question once your program sucessfully generates them)

mod 2:

0 -&gt; 0
1 -&gt; 0


mod 3:

0 -&gt; 0
1 -&gt; 1
2 -&gt; 2


mod 4:

0 -&gt; 0
1 -&gt; 2
2 -&gt; 0
3 -&gt; 2


mod 5:

0 -&gt; 0
1 -&gt; 0
2 -&gt; 0
3 -&gt; 0
4 -&gt; 0


mod 6:

0 -&gt; 0
1 -&gt; 4
2 -&gt; 2
3 -&gt; 0
4 -&gt; 4
5 -&gt; 2


mod 7:

0 -&gt; 0
1 -&gt; 3
2 -&gt; 6
3 -&gt; 2
4 -&gt; 5
5 -&gt; 1
6 -&gt; 4


mod 8:

0 -&gt; 0
1 -&gt; 2
2 -&gt; 4
3 -&gt; 6
4 -&gt; 0
5 -&gt; 2
6 -&gt; 4
7 -&gt; 6


mod 9:

0 -&gt; 0
1 -&gt; 1
2 -&gt; 2
3 -&gt; 3
4 -&gt; 4
5 -&gt; 5
6 -&gt; 6
7 -&gt; 7
8 -&gt; 8


mod 10:

0 -&gt; 0
1 -&gt; 0
2 -&gt; 0
3 -&gt; 0
4 -&gt; 0
5 -&gt; 0
6 -&gt; 0
7 -&gt; 0
8 -&gt; 0
9 -&gt; 0


Rules

This is code-golf, shortest code in bytes wins.

As usual, loopholes and cheats are forbidden.
Mathematica, 192 bytes

This type of challenge (nontrivial mathematical computation together with high-level graphics output) is what Mathematica is made for!

(d=#;r_~t~n_:=r{Sin[#],Cos[#]}&amp;[6.3n/d];m=Mod[10#,d]&amp;;Graphics@{Array[#~Text~t[9,#]&amp;,d,0],Array[Arrow@{t[9,#+1/7],t[9,#+6/7]}&amp;,d],Array[Arrow@BezierCurve@{t[8,#+1/9],{0,0},t[8,m@#-1/9]}&amp;,d]})&amp;


Expanded and explained:

[1] (
[2] d = #; r_~t~n_ := r {Sin[#], Cos[#]} &amp;[6.3 n/d]; m = Mod[10 #, d] &amp;;
[3] Graphics@{
[4]   Array[#~Text~t[9, #] &amp;, d, 0],
[5]   Array[Arrow@{t[9, # + 1/7], t[9, # + 6/7]} &amp;, d],
[6]   Array[Arrow@BezierCurve@{t[8, # + 1/9], {0, 0}, t[8, m@# - 1/9]} &amp;, d]
[7]          }
[8] ) &amp;


Lines 1 and 8 delimit an unnamed function of one argument. Lines 3 and 7 delimit several commands that output graphics.

Lines 2 stores the input as d; defines a binary function t giving the coordinates of a point n/d of the way around the circle of radius r, clockwise from the top (in the spirit of this site, I saved a byte by rounding 2π to 6.3!); and defines a unary function m calculating the destination of the arrow starting at its argument.

Line 4 renders the numbers 0 to d–1 equally spaced around the circle of radius 9 (the exact radius unimportant, chosen to maximize aesthetics subject to fitting in one byte).

Line 5 renders the clockwise straight arrows around the circumference of the circle. The 1/7 and 6/7 leave enough space to read the numbers.

Line 6 renders the curved arrows from each number to (10 times the number modulo d). BezierCurve automatically draws a Bézier curve using the given control points. Fortunately, using the origin as a single interior control point produces reasonable output.

Sample output (note that the cases 9, 10, and 11 are trivial in different ways):

d = 7



d = 8



d = 9



d = 10



d = 11



d = 12



d = 13



d = 37



This last input was chosen because 37 divides 10^3–1, and so the interior arrows (not counting the obligatory self-arrow from 0 to 0) form lots of triangular cycles.