912. Where are the Odds?

Let sn be the n-th positive integer that does not contain three consecutive ones in its binary representation.
For example, s1=1 and s7=8.

Define F(N) to be the sum of n2 for all n≤N where sn is odd. You are given F(10)=199.

Find F(1016) giving your answer modulo 109+7.

912. 奇数在哪里?

记 sn 为第 n 个满足二进制表示下没有连续的三个 1 的正整数,例如 s1=1、s7=8。

记 F(N) 为:对所有满足 n≤N、sn 是奇数的正整数 n,其 n2 的和。已知 F(10)=199。

求 F(1016) 模 (109+7) 的值。


点 这个链接 回到源站。

点 这个链接 回到详细版题目目录。