Imagine that you have an array of 3 integers each representing a different person. Each number can be 0, 1, or 2 which represents the number of hands that person holds up.

Now imagine there is a sequence which follows these rules:
* None of the people have their arms raised at first
* Firstly, a person raises 1 hand; then they raise the second hand; after that they put both hands down - these steps form a cycle
* Person #1 performs these steps all the time, person #2 advances only after person #1 puts their hands down, and person #3 advances only after person #2 puts their hands down

The first 10 steps of the sequence represented as a table are:

```
Step   P1   P2   P3
--------------------
 0     0    0    0
 1     1    0    0
 2     2    0    0
 3     0    1    0
 4     1    1    0
 5     2    1    0
 6     0    2    0
 7     1    2    0
 8     2    2    0
 9     0    0    1
```

Given a number, return an array with the number of hands raised by each person at that step.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def get_positions(n):
	

Solutions:
def get_positions(n):
	return tuple((n // d % 3 for d in (1, 3, 9)))


def get_positions(n):
	return (n % 3, n // 3 % 3, n // 9 % 3)


def get_positions(n):
	num2 = n
	num3 = n
	p2 = [0, 0, 0, 1, 1, 1, 2, 2, 2]
	p3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2]
	while num2 >= 9:
		num2 = num2 % 9
	n2 = p2[num2]
	while num3 >= 27:
		num3 = num3 % 27
	n3 = p3[num3]
	return (n % 3, n2, n3)


def create_postions():
	p1 = [0, 1, 2] * 9
	p2 = [*[0] * 3, *[1] * 3, *[2] * 3] * 3
	p3 = [0] * 9 + [1] * 9 + [2] * 9
	arr = list(zip(p1, p2, p3))
	return lambda n: arr[n % 27]
get_positions = create_postions()


def get_positions(n):
	(n, x) = divmod(n, 3)
	(n, y) = divmod(n, 3)
	(n, z) = divmod(n, 3)
	return (x, y, z)


import math

def get_positions(n):
	return (n % 3, math.floor(n / 3 % 3), math.floor(n / 9 % 3))


def get_positions(n):
	num = n % 27
	return (num % 3, int(num % 3 ** 2 / 3 ** 1), int(num / 3 ** 2))


def get_positions(s):
	return (s % 3, s // 3 % 3, s // 9 % 3)


def ternary(n):
	if n == 0:
		return '0'
	nums = []
	while n:
		(n, r) = divmod(n, 3)
		nums.append(str(r))
	return ''.join(reversed(nums))

def get_positions(n):
	return tuple((int(d) for d in ternary(n)[-3:].zfill(3)[::-1]))