题目175:跟用2的幂之和来表示数字的方式个数有关的分数
Fractions involving the number of different ways a number can be expressed as a sum of powers of 2Define 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>0, q>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.
题目:
定义 f(0)=1,f(n) 为 n 可以用 2 的不同次幂之和表示的方式,其中每种幂最多出现两次。
比如,f(10)=5,因为,有 5 种不同的方式来表示 10:
10 = 8+2 = 8+1+1 = 4+4+2 = 4+2+2+1+1 = 4+4+1+1
可以证明,对于每个分数 p/q 存在至少一个整数 n 满足:
f(n)/f(n-1)=p/q。
比如,最小的满足 f(n)/f(n-1)=13/17 的是 241。
二进制的 241 是 11110001。这个二进制数,从最高位到最低位,有 4 个 1,3 个 0,再一个 1。我们就把字符串 4,3,1 叫做数字 241 的二进制简化表示。
请找出满足 f(n)/f(n-1)=123456789/987654321 的最小 n 的二进制简化表示。
请把结果用逗号(英文输入法下的)分隔开来,不要带空格。
页:
[1]