Number of repetitions of modular operation

107 Views Asked by At

I am looking into a problem that is about threaded pins on a circle. See image bellow for an example:
enter image description here

I approached it as follows:
Let $P$ be the number of pins and $G$ the number of gaps.
Number the pins on the circle from $0$ to $(P-1)$. The process of moving the thread from pin to pin is just a modulo operation on $P$. I.e. for $5$ pins and gap of $2$ we connect:
$0$ with $2$ i.e. $(0+2)\space mod \space 5$
$2$ with $4$ i.e. $(2 + 2)\space mod\space 5$
$4$ with $1$ i.e. $(4 + 2)\space mod\space5$
$1$ with $3$ i.e. $(1 + 2)\space mod\space5$
$3$ with $0$ i.e. $(3 + 2)\space mod\space 5$

That requires 1 thread since we reached 0. This process can be applied to all the rest of the configurations.

For 6 pins and 2 gaps we connect:
$0$ with $2$ i.e. $(0 + 2)\space mod \space 6$
$2$ with $4$ i.e. $(2 + 2)\space mod \space 6$
$4$ with $0$ i.e. $(4 + 2)\space mod \space 6$
That was thread $1$ and we start again with pin $1$ since we got back to pin $0$.
We connect:
$1$ with $3$ i.e. $(1 + 2)\space mod \space 6$
$3$ with $5$ i.e. $(3 + 2)\space mod \space 6$
$5$ with $1$ i.e. $(5 + 2)\space mod \space 6$
That was thread $2$. I.e. we need $2$ threads as $2$ repeats of the process happened.

So each time we just wrap around the modulo $P$ and increment by $1$ and start over. The number of repetitions equals the number of threads

My problem is how to formalize the process in a way to shows that the number of threads increments based on this modulo operation.

Note: There is a post about the same problem here: Threaded pins but my question is different.

I do understand the solution about using the greatest common divisor. What I am looking for is how could I extend the modulo process I have described to reach the solution. Or is gcd also related in this approach too?

1

There are 1 best solutions below

5
On

The answer to your final question is no - it is a nicely presented question.

Your modulo method returns to $0$ when $$0,G,2G,3G,...,kG$$ reaches $0$ i.e. $$kG\equiv 0\pmod P.$$

This requires $$k=\frac{P}{\gcd(P,G)}.$$

Therefore the number of threads you require is $$\frac{P}{k}=\gcd(P,G).$$

Thus the methods are the same.