Imagine two rings with numbers on them. The inner ring spins clockwise (decreasing by 1 each spin) and the outer ring spins counter clockwise (increasing by 1 each spin). We start with both rings aligned on 0 at the top, and on each move we spin each ring one increment. How many moves will it take before both rings show the same number at the top again?

The inner ring has integers from 0 to innerMax and the outer ring has integers from 0 to outerMax, where innerMax and outerMax are integers >= 1.

```
e.g. if innerMax is 2 and outerMax is 3 then after
1 move: inner = 2, outer = 1
2 moves: inner = 1, outer = 2
3 moves: inner = 0, outer = 3
4 moves: inner = 2, outer = 0
5 moves: inner = 1, outer = 1
Therefore it takes 5 moves for the two rings to reach the same number
Therefore spinningRings(2, 3) = 5
```
```
e.g. if innerMax is 3 and outerMax is 2 then after
1 move: inner = 3, outer = 1
2 moves: inner = 2, outer = 2
Therefore it takes 2 moves for the two rings to reach the same number
spinningRings(3, 2) = 2
```

---

for a bigger challenge, check out the [Performance Version](https://www.codewars.com/kata/59b0b7cd2a00d219ab0000c5) of this kata by @Voile

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def spinning_rings(inner_max, outer_max):
	

Solutions:
from itertools import count

def spinning_rings(inner_max, outer_max):
	return next((i for i in count(1) if i % (outer_max + 1) == -i % (inner_max + 1)))


def spinning_rings(inner_max, outer_max):
	(a, b, res) = (inner_max, 1, 1)
	while a != b:
		a = (a + inner_max) % (inner_max + 1)
		b = (b + 1) % (outer_max + 1)
		res += 1
	return res


from itertools import cycle

def spinning_rings(inMax, outMax):
	(inc, outc) = (cycle([0] + list(range(1, inMax + 1))[::-1]), cycle(range(outMax + 1)))
	(a, b, count) = (next(inc), next(outc), 0)
	while True:
		(a, b, count) = (next(inc), next(outc), count + 1)
		if a == b:
			return count


def spinning_rings(inner_max, outer_max):
	(moves, inner, outer) = (0, 0, 0)
	while True:
		inner -= 1
		inner %= inner_max + 1
		outer += 1
		outer %= outer_max + 1
		moves += 1
		if inner == outer:
			break
	return moves


def spinning_rings(inner_max, outer_max):
	(a, b, c) = (0, 0, 0)
	while True:
		a = (a - 1) % (inner_max + 1)
		b = (b + 1) % (outer_max + 1)
		c += 1
		if a == b:
			return c


def spinning_rings(inner_max, outer_max):
	i = 1
	while -(i % (-inner_max - 1)) != i % (outer_max + 1):
		i += 1
	return i


from itertools import cycle

def spinning_rings(inner_max, outer_max):
	out = cycle(range(outer_max + 1))
	inn = cycle([0] + list(range(inner_max, 0, -1)))
	next(inn)
	next(out)
	count = 0
	while next(inn) != next(out):
		count += 1
	return count + 1


def spinning_rings(inner_max, outer_max):
	innerList = [0] + [i for i in range(inner_max, 0, -1)]
	outerList = [0] + [i for i in range(1, outer_max + 1)]
	tries = 1
	while True:
		if innerList[tries % (inner_max + 1)] == outerList[tries % (outer_max + 1)]:
			return tries
			break
		tries += 1