The [Sharkovsky's Theorem](https://en.wikipedia.org/wiki/Sharkovskii%27s_theorem) involves the following ordering of the natural numbers:
```math
3≺5≺7≺9≺ ...\\
≺2·3≺2·5≺2·7≺2·9≺...\\
≺2^n·3≺2^n·5≺2^n·7≺2^n·9≺...\\
≺2^{(n+1)}·3≺2^{(n+1)}·5≺2^{(n+1)}·7≺2^{(n+1)}·9≺...\\
≺2^n≺2^{(n-1)}≺...\\
≺4≺2≺1\\
```
 
Your task is to complete the function which returns `true` if `$a≺b$` according to this ordering, and `false` otherwise.
 
You may assume both `$a$` and `$b$` are non-zero positive integers.

Difficulty: EASY
Tags: Mathematics

Starter code:
def sharkovsky(a, b):
	

Solutions:
def sharkovsky(a, b):
	return f(a) < f(b)

def f(n, p=0):
	while n % 2 == 0:
		n >>= 1
		p += 1
	return (n == 1, p * (-1) ** (n == 1), n)


def analyse(x):
	n = (b := bin(x)).rstrip('0')
	p = len(b) - len(n)
	return ((n := int(n, 2)) == 1, p * (-1) ** (n == 1), n)

def sharkovsky(a, b):
	return analyse(a) < analyse(b)


key = lambda n: [(0, (e := (n & -n)), n // e), (1, -n)][e == n]
sharkovsky = lambda a, b: key(a) < key(b)


from math import log

def decompose(n):
	for p in range(int(log(n, 2)), -1, -1):
		c = n / 2 ** p
		if c == int(c):
			c = int(c)
			return (c, p)

def sharkovsky(a, b):
	(coef_a, exp_a) = decompose(a)
	(coef_b, exp_b) = decompose(b)
	if coef_a == 1 and coef_b == 1:
		return exp_b < exp_a
	if coef_a == 1 or coef_b == 1:
		return coef_b == 1
	if exp_a != exp_b:
		return exp_a < exp_b
	if exp_a == exp_b:
		return coef_a < coef_b
	return False


def div2(n):
	i = 0
	while n % 2 == 0:
		n = n / 2
		i += 1
	return (n, i)

def sharkovsky(a, b):
	(n1, rem1) = div2(a)
	(n2, rem2) = div2(b)
	if n1 == 1 and n2 == 1:
		return not rem1 < rem2
	elif n1 == 1 and n2 != 1:
		return False
	elif n1 != 1 and n2 == 1:
		return True
	elif rem1 == rem2:
		return n1 < n2
	else:
		return rem1 < rem2


def sharkovsky(a, b):
	if b == a:
		return False
	elif b == 1:
		return True
	elif a == 1:
		return False
	elif a % 2 == 1:
		if b % 2 == 0:
			return True
		elif a < b:
			return True
		else:
			return False
	elif b % 2 == 1:
		return False
	else:
		result = sharkovsky(a / 2, b / 2)
		return result


def sharkovsky(a, b):

	def key(n):
		even = n & -n
		return [(even, n // even), (float('inf'), -n)][n == even]
	return key(a) < key(b)


def sharkovsky(a, b):
	if a == b:
		return False
	if a == 1:
		return False
	if b == 1:
		return a > 1
	c = get_highest_power_of_two_divisible_by_number(a)
	d = get_highest_power_of_two_divisible_by_number(b)
	if c == d:
		a //= c
		b //= d
		if a != 1 and b == 1:
			return True
		elif a == 1:
			return False
		else:
			return a < b
	elif c < d:
		a //= c
		b //= d
		if a == 1 and b != 1:
			return False
		elif a == 1 and b == 1:
			return False
		else:
			return True
	else:
		a //= c
		b //= d
		if a != 1 and b == 1:
			return True
		elif a == 1 and b == 1:
			return True
		else:
			return False

def get_highest_power_of_two_divisible_by_number(number):
	twos = []
	while number % 2 == 0:
		twos.append(2)
		number //= 2
	result = 2 ** len(twos)
	return result

def is_power_of_two(number):
	twos = []
	while number % 2 == 0:
		twos.append(2)
		number //= 2
	twos = remove_duplicates(twos)
	return twos == [2]

def remove_duplicates(lst):
	result = []
	for i in lst:
		if i not in result:
			result.append(i)
	return result


import numpy as np

def sharkovsky(a, b):
	l = []
	for i in range(0, int(np.log2(max(a, b))) + 3):
		for j in range(3, max(a, b) + 1, 2):
			if a == 2 ** i * j:
				l.append(a)
				a = b
				if len(l) >= 2:
					return True
	for n in range(int(np.log2(max(a, b))) + 3, -1, -1):
		if a == 2 ** n:
			l.append(a)
			a = b
			if len(l) >= 2:
				return True
	return False


def sharkovsky(a, b):
	i = 0
	while a % 2 == 0:
		a //= 2
		i += 1
	j = 0
	while b % 2 == 0:
		b //= 2
		j += 1
	if a == 1 and b == 1:
		return i > j
	elif a == 1:
		return False
	elif b == 1:
		return True
	elif i == j:
		return a < b
	else:
		return i < j


def sharkovsky(a, b):

	def Answer(n):
		con = True
		p = 0
		while con == True:
			if n % 2 != 0:
				ans = (p, n)
				con = False
			else:
				n = n / 2
				p += 1
		return ans
	ans_a = Answer(a)
	ans_b = Answer(b)
	if ans_a[1] == 1 and ans_b[1] != 1:
		return False
	elif ans_a[1] != 1 and ans_b[1] == 1:
		return True
	elif ans_a[1] == 1 and ans_b[1] == 1:
		return ans_a[0] > ans_b[0]
	elif ans_a[0] > ans_b[0]:
		return False
	elif ans_a[0] < ans_b[0]:
		return True
	else:
		return ans_a[1] < ans_b[1]


def sharkovsky(a, b):
	if a % 2 == 0 and b % 2 == 0:
		while a % 2 == 0 and b % 2 == 0:
			a = a / 2
			b = b / 2
	if b % 2 == 0:
		if a == 1:
			return 1 == 2
		else:
			return 1 == 1
	elif a % 2 == 0:
		if b == 1:
			return 1 == 1
		else:
			return 1 == 2
	elif b == 1:
		return 1 == 1
	elif a == 1:
		return 1 == 2
	else:
		return a < b


def sharkovsky(a, b):
	while True:
		if a == 1 or b == 1:
			return a != 1
		if a % 2 or b % 2:
			return a % 2 == 1 and (not (b % 2 == 1 and a >= b))
		a /= 2
		b /= 2


def sharkovsky(a, b):
	(power_a, odd_number_a) = solve(a)
	(power_b, odd_number_b) = solve(b)
	print(('a info power then oddnum', power_a, odd_number_a))
	if odd_number_a == 1 and odd_number_b == 1:
		return True if power_a > power_b else False
	elif odd_number_a == 1 and odd_number_b > 1:
		return False
	elif odd_number_a > 1 and odd_number_b == 1:
		return True
	elif power_a > power_b:
		return False
	elif power_a < power_b:
		return True
	elif power_a == power_b:
		return True if odd_number_a < odd_number_b else False

def solve(a):
	power_of_two = 0
	num = a
	while num % 2 == 0:
		power_of_two += 1
		num = num / 2
	return (power_of_two, a / 2 ** power_of_two)


import math

def splitnumber(x):
	counter = 0
	while x % 2 == 0:
		counter += 1
		x = x / 2
	return [counter, x]

def sharkovsky(a, b):
	x = splitnumber(a)
	y = splitnumber(b)
	if x[1] == 1 and y[1] == 1:
		return a > b
	elif x[1] != 1 and y[1] == 1:
		return True
	elif x[1] == 1 and y[1] != 1:
		return False
	elif x[0] == y[0]:
		return a < b
	else:
		return x[0] < y[0]
	return False


def sharkovsky(a, b):
	if a == b:
		return False
	if a < 3:
		return False
	if b < 3:
		return True
	print(a, b)
	higher = max(a, b)
	lower = min(a, b)
	number = 3
	while number <= higher:
		if number == a:
			return True
		if number == b:
			return False
		number = number + 2
	counter = 3
	number = 2 * counter
	while number <= higher:
		if number == a:
			return True
		if number == b:
			return False
		counter = counter + 2
		number = 2 * counter
	counter = 3
	exponential = 1
	number = 2 ** exponential * counter
	while number <= higher:
		if number == a:
			return True
		if number == b:
			return False
		counter = counter + 2
		exponential = exponential + 1
		number = 2 ** exponential * counter
	counter = 3
	exponential = 2
	number = 2 ** exponential * counter
	while number <= higher:
		if number == a:
			return True
		if number == b:
			return False
		counter = counter + 2
		exponential = exponential + 1
		number = 2 ** exponential * counter
	exponential = 1
	number = 2 ** exponential
	while number >= lower:
		if number == a:
			return True
		if number == b:
			return False
		exponential = exponential - 1
		number = 2 ** exponential
	number = higher
	while number >= lower:
		if number == a:
			return True
		if number == b:
			return False
		number = number - 2
	return False


import math

def max2pow(n):
	even = 1
	while n % 2 == 0:
		even *= 2
		n /= 2
	return (even, n)

def sharkovsky(a, b):
	if a == b:
		return False
	(even_a, odd_a) = max2pow(a)
	(even_b, odd_b) = max2pow(b)
	if odd_a == 1 and odd_b == 1:
		return even_a > even_b
	if odd_a == 1 or odd_b == 1:
		return odd_b == 1
	if even_a == even_b:
		return odd_a < odd_b
	return even_a < even_b


import math

def sharkovsky(a, b):
	if a % 2 != b % 2:
		if b == 1:
			return True
		elif (a % 2 == 1) & (a != 1):
			return True
		else:
			return False
	elif a % 2 == 1:
		if b == 1:
			return True
		elif (a < b) & (a != 1):
			return True
		else:
			return False
	elif (math.pow(2, int(math.log2(a))) == a) & (math.pow(2, int(math.log2(b))) == b) & (a > b):
		return True
	elif math.pow(2, int(math.log2(a))) != a:
		if math.pow(2, int(math.log2(b))) == b:
			return True
		else:
			i = 0
			while a % 2 == 0 and b % 2 == 0:
				i += 1
				a = a / 2
				b = b / 2
			if b % 2 == 0:
				return True
			elif a % 2 == 0:
				return False
			elif a < b:
				return True
			else:
				return False
	else:
		return False


def sharkovsky(a, b):
	a_red = a
	a_rem = a % 2
	a_count = 0
	while a_rem == 0:
		a_count = a_count + 1
		a_red = int(a_red / 2)
		a_rem = a_red % 2
	b_red = b
	b_rem = b % 2
	b_count = 0
	while b_rem == 0:
		b_count = b_count + 1
		b_red = int(b_red / 2)
		b_rem = b_red % 2
	if a_red > 1 and b_red > 1:
		if a_count != b_count:
			return a_count < b_count
		else:
			return a_red < b_red
	elif a_red == 1 and b_red > 1:
		return False
	elif a_red > 1 and b_red == 1:
		return True
	else:
		return a_count > b_count


def factorTwos(n):
	twos = 0
	while not n % 2:
		n //= 2
		twos += 1
	return (twos, n)

def sharkovsky(a, b):
	(twosA, remA) = factorTwos(a)
	(twosB, remB) = factorTwos(b)
	if remA == 1:
		return remB == 1 and twosA > twosB
	elif remB == 1:
		return remA != 1 or twosA > twosB
	elif twosA == twosB:
		return remA < remB
	else:
		return twosA < twosB