You will be given two numbers `m,n`. The numbers could span from `0` to `10000`. We can get their product by using binary reduction as show in the table below.
Example (to understand the table please read the description below it) 





real value of m(r)
m
n
(r*n)


0
100
15
0


0
50
30
0


1
25
60
60


0
12
120
0


0
6
240
0


1
3
480
480


1
1
960
960



Above, we are given two numbers `100` and `15`. we keep reducing the bigger number by dividing it by `2` and hold the integer part of the division till it is no more divisible by `2`. Then we assign the real values to these reduced parts of `m`. Any reduced number `[1,m]` has real value of `0` if it is even, and it will have real value of `1` if it is odd. On the other hand the smaller number in this case `n` keeps on doubling itself the same amount of times `m` reduces itself. The idea of this method is to change multiplication of two big number to a sequence of multiplication by `0` or `1` and perform addition to get the final product. You can see that from the last column `(r*n)` above. 
if we sum the last column we get `0+60+0+0+480+960=1500=100*15`
Now your task for this kata will be to get those non-zero number in the last column in an array and return it sorted in descending order.so for the above example the return will be `[960,480,60]`.

_Beware: _`m,n`_ are not necessarily ordered._

Difficulty: EASY
Tags: Mathematics

Ad-hoc

Starter code:
def bin_mul(m,n):
	

Solutions:
def bin_mul(m, n):
	if m < n:
		return bin_mul(n, m)
	if n == 0:
		return []
	res = []
	while m > 0:
		if m % 2 == 1:
			res.append(n)
		m = m // 2
		n *= 2
	return res[::-1]


def bin_mul(m, n):
	if m < n:
		(m, n) = (n, m)
	xs = []
	while m >= 1:
		(m, m_r) = divmod(m, 2)
		if m_r and n:
			xs.append(n)
		n *= 2
	return sorted(xs, reverse=True)


def bin_mul(m, n):
	if m < n:
		return bin_mul(n, m)
	if n == 0:
		return []
	r = []
	while m >= 1:
		print(m, n)
		if m % 2:
			r.append(1 * n)
		m = m // 2
		n = n * 2
	return sorted(r, reverse=True)


def bin_mul(m, n):
	result = []
	(ma, mi) = (max(m, n), min(m, n))
	while ma != 0:
		if ma % 2 and mi != 0:
			result = [mi] + result
		mi *= 2
		ma //= 2
	return result


def bin_mul(a, b):
	((b, a), r) = (sorted((a, b)), [])
	while a:
		if a % 2 and b:
			r.append(b)
		a //= 2
		b *= 2
	return r[::-1]


def decimalToBinary(n):
	return bin(n).replace('0b', '')

def bin_mul(m, n):
	Binval = m
	Top = n
	if m < n:
		Binval = n
		Top = m
	Binary = list(decimalToBinary(Binval))
	val = []
	Binary.reverse()
	for x in Binary:
		if int(x) == 1 and Top != 0:
			val.append(int(x) * Top)
		Binval -= int(abs(Binval / 2))
		Top *= 2
	return val[::-1]


def bin_mul(m, n):
	(n, m) = sorted((m, n))
	r = [n] if m % 2 and n else []
	while m:
		m >>= 1
		n <<= 1
		if m % 2 and n:
			r.append(n)
	return sorted(r, reverse=True)


def bin_mul(m, n):
	r = []
	(n, m) = sorted((m, n))
	if not n:
		return r
	while m:
		if m % 2:
			r += (n,)
		m //= 2
		n *= 2
	return r[::-1]


def bin_mul(m, n):
	r = []
	(n, m) = sorted([m, n])
	if n == 0:
		return []
	while m > 1:
		if m % 2 == 1:
			r.insert(0, n)
		m //= 2
		n *= 2
	r.insert(0, n)
	return r


def bin_mul(m, n):
	if not n or not m:
		return []
	(max_p, min_p) = (max(m, n), min(m, n))
	products = []
	while max_p > 0:
		if max_p % 2:
			products.append(max_p % 2 * min_p)
		(max_p, min_p) = (max_p // 2, min_p * 2)
	products.sort()
	products.reverse()
	return products