惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - 空军

过多边形边上某点的任意直线等分面积 VisualAPL Installer for Visual Studio 2008 [ZT] Create a Microsoft Access Database Using ADOX and Visual Basic .NET 为System.Windows.Forms.FontDialog类添加Location属性 f(f(x)) = -x [zt]〖Math〗构造函数使得任意小的区间所对应的值域都是整个实数域 [zt]鸟巢、水立方:同一个地方,同一梦想 〖Math〗据传,任意锐角等于0° 爱因斯坦的超级问题(谁养鱼)SQL解法 “槑囧圐圙”您认得这些汉字吗? 根据URL提取页面的Title,根据网页的charset自动判断Encoding MSDN“MidpointRounding 枚举”中文翻译有误 C# 2.0 新特性(泛型、可空类型)应用一例 表达式计算器 Google速记 Google中国编程挑战赛第一轮 Google中国编程挑战赛资格赛 数学家 数据库访问模块
数的分解,据说是清华的一道复试上机题
空军 · 2010-03-27 · via 博客园 - 空军

来源: http://topic.csdn.net/u/20100325/20/38e39935-9463-452c-a194-1ed8f6b49c99.html

任何数都能分解成2的幂,
例如:7
=1+1+1+1+1+1+1
=1+1+1+1+1+2
=1+1+1+2+2
=1+1+1+4
=1+2+2+2
=1+2+4
求任意整数n(n<100亿)的此类划分数。


解:

记f(n)为n的划分数,我们有递推公式:
f(2m + 1) = f(2m),
f(2m) = f(2m - 1) + f(m),
初始条件:f(1) = 1。


证明:

证明的要点是考虑划分中是否有1。

记:
A(n) = n的所有划分组成的集合,
B(n) = n的所有含有1的划分组成的集合,
C(n) = n的所有不含1的划分组成的集合,
则有: A(n) = B(n)∪C(n)。

又记:
f(n) = A(n)中元素的个数,
g(n) = B(n)中元素的个数,
h(n) = C(n)中元素的个数,
易知: f(n) = g(n) + h(n)。

以上记号的具体例子见文末。


我们先来证明: f(2m + 1) = f(2m),
首先,2m + 1 的每个划分中至少有一个1,去掉这个1,就得到 2m 的一个划分,故 f(2m + 1)≤f(2m)。
其次,2m 的每个划分加上个1,就构成了 2m + 1 的一个划分,故 f(2m)≤f(2m + 1)。
综上,f(2m + 1) = f(2m)。

接着我们要证明: f(2m) = f(2m - 1) + f(m),
把 B(2m) 中的划分中的1去掉一个,就得到 A(2m - 1) 中的一个划分,故 g(2m)≤f(2m - 1)。
把 A(2m - 1) 中的划分加上一个1,就得到 B(2m) 中的一个划分,故 f(2m - 1)≤g(2m)。
综上,g(2m) = f(2m - 1)。

把 C(2m) 中的划分的元素都除以2,就得到 A(m) 中的一个划分,故 h(2m)≤f(m)。
把 A(m) 中的划分的元素都乘2,就得到 C(2m) 中的一个划分,故 f(m)≤h(2m)。
综上,h(2m) = f(m)。

所以: f(2m) = g(2m) + h(2m) = f(2m - 1) + f(m)。                                            

这就证明了我们的递推公式。


记 f(0) = 1,根据递推公式,可以得到:
f(2m) = f(0) + f(1) + ... + f(m)。
(证明留给读者)


一些例子:

A(3) = {
  (1,1,1)
  (1,2)
},
f(3) = 2,

A(4) = {
 (1,1,1,1)
  (1,1,2)
  (2,2)
  (4)
},
f(4) = 4,

A(5) = {
 (1,1,1,1,1)
  (1,1,1,2)
  (1,2,2)
  (1,4)
},
f(5) = 4,

A(6) = {
 (1,1,1,1,1,1)
  (1,1,1,1,2)
  (1,1,2,2)
  (1,1,4)
  (2,2,2)
  (2,4)
},
f(6) = 6,

B(6) = {
 (1,1,1,1,1,1)
  (1,1,1,1,2)
  (1,1,2,2)
  (1,1,4)
},
g(6) = 4,

C(6) = {
  (2,2,2)
  (2,4)
},
h(6) = 2.