- All Contests
- ProjectEuler+
- Project Euler #175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2.

# Project Euler #175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2.

# Project Euler #175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2.

_{This problem is a programming version of Problem 175 from projecteuler.net}

Define and to be the number of ways to write as a sum of powers of 2 where no power occurs more than twice.

For example, since there are five different ways to express 10:

It can be shown that for every fraction (, ) there exists at least one integer such that .

For instance, the smallest for which is .

The binary expansion of is .

Reading this binary number from the most significant bit to the least significant bit there are one's, zeroes and one. We shall call the string the *Shortened Binary Expansion* of .

Find the Shortened Binary Expansion of the smallest for which

**Input Format**

The first line of input contains two space-separated integers and .

**Constraints**

**Output Format**

Print your answer as comma-separated integers without any whitespaces.

**Sample Input 0**

```
13 17
```

**Sample Output 0**

```
4,3,1
```

**Explanation 0**

As described in statement, answer for is .