Fractions and Sum of Powers of Two

Define $f(0)=1$ and $f(n)$ to be the number of ways to write $n$ as a sum of powers of $2$ where no power occurs more than twice.

For example, $f(10)=5$ since there are five different ways to express $10$:$10 = 8+2 = 8+1+1 = 4+4+2 = 4+2+2+1+1 = 4+4+1+1.$

It can be shown that for every fraction $p / q$ ($p \gt 0$, $q \gt 0$) there exists at least one integer $n$ such that $f(n)/f(n-1)=p/q$.

For instance, the smallest $n$ for which $f(n)/f(n-1)=13/17$ is $241$.
The binary expansion of $241$ is $11110001$.
Reading this binary number from the most significant bit to the least significant bit there are $4$ one’s, $3$ zeroes and $1$ one. We shall call the string $4,3,1$ the Shortened Binary Expansion of $241$.

Find the Shortened Binary Expansion of the smallest $n$ for which $f(n)/f(n-1)=123456789/987654321$.

Give your answer as comma separated integers, without any whitespaces.

To solve this problem, we will use the known properties of Stern’s Diatomic Series. Stern’s diatomic sequence (denoted F(n) in this problem) is defined by F(0) = 0, F(1) = 1 and for n > 1, F(n) = F(floor(n/2)) + F(ceil(n/2)).

First, observe a property of Stern’s sequence. If p and q are relatively prime positive integers and n is the smallest positive integer such that F(n)/F(n-1) = p/q. Then n reads in binary as 1_{e1} 0_{e2} 1_{e3}…0_{ek} 1_{ek+1} where the e’s are the partial quotients in the continued fraction for p/q.

The continued fraction of 123456789 / 987654321 can be calculated as [0; 8, 1, 3, 1, 4, 1, 1, 2, 2, 3, 9 ,4].

Using the property of the Stern’s sequence, we see that the Shortened Binary Expansion of the smallest n for which f(n) / f(n-1) = 123456789 / 987654321 is the sequence of numbers (excluding the first zero): 8, 1, 3, 1, 4, 1, 1, 2, 2, 3, 9, 4.

So the answer should be given as: 8,1,3,1,4,1,1,2,2,3,9,4. This would be the Shortened Binary Expansion of the required number.

More Answers:
Few Repeated Digits
Hollow Square Laminae I
Hollow Square Laminae II

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Don't Miss Out! Sign Up Now!

Sign up now to get started for free!