forked from PE-CN/PE-CN.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
678 lines (455 loc) · 19.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
<!doctype html>
<html class="theme-next use-motion theme-next-mist">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="stylesheet" type="text/css" href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5"/>
<link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.3"/>
<meta name="description" content="Project Euler | 欧拉计划 中文翻译站" />
<meta name="keywords" content="Hexo,next" />
<link rel="shorticon icon" type="image/x-icon" href="/favicon.ico?v=0.4.3" />
<script type="text/javascript" id="hexo.configuration">
var CONFIG = {
scheme: 'Mist',
analytics: {
google: 'UA-65757005-1'
},
sidebar: 'post'
};
</script>
<title> Problem 153 // Project Euler | 欧拉计划 </title>
</head>
<body>
<!--[if lte IE 8]>
<div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;margin:0 auto;'>
<a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
<img src="http://7u2nvr.com1.z0.glb.clouddn.com/picouterie.jpg" border="0" height="42" width="820"
alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today or use other browser ,like chrome firefox safari."
style='margin-left:auto;margin-right:auto;display: block;'/>
</a>
</div>
<![endif]-->
<div class="container one-column page-post-detail">
<div class="headband"></div>
<div id="header" class="header">
<div class="header-inner">
<h1 class="site-meta">
<span class="logo-line-before"><i></i></span>
<a href="/" class="brand">
<span class="logo">
<i class="icon-logo"></i>
</span>
<span class="site-title">Project Euler | 欧拉计划</span>
</a>
<span class="logo-line-after"><i></i></span>
</h1>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
<div class="site-nav">
<ul id="menu" class="menu menu-left">
<li class="menu-item menu-item-home">
<a href="/">
<i class="menu-item-icon icon-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-problems">
<a href="/problems">
<i class="menu-item-icon icon-problems"></i> <br />
题目
</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about">
<i class="menu-item-icon icon-about"></i> <br />
关于
</a>
</li>
</ul>
<div class="site-search">
<form class="site-search-form">
<input type="text" id="st-search-input" class="st-search-input st-default-search-input" />
</form>
<script type="text/javascript">
(function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
(w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
})(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');
_st('install', 'z6bmYNMJM3AR1esetWJa','2.0.0');
</script>
<div class="site-search-toggle"></div>
</div>
</div>
</div>
</div>
<div id="main" class="main">
<div class="main-inner">
<div id="content" class="content">
<div id="posts" class="posts-expand">
<div class="post post-type-normal ">
<div class="post-header">
<h1 class="post-title">
Problem 153
</h1>
<div class="post-meta">
<span class="post-time">
发表于 2007-05-04
</span>
<span class="post-comments-count">
|
<a href="/153/#comments" >
<span class="post-comments-count ds-thread-count" data-thread-key="153/"></span>
</a>
</span>
</div>
</div>
<div class="post-body">
<hr>
<h1 id="Problem_153"><a href="https://projecteuler.net/problem=153" target="_blank" rel="external">Problem 153</a></h1><hr>
<p><b>Investigating Gaussian Integers</b></p>
<p>As we all know the equation x<sup>2</sup>=-1 has no solutions for real x.<br>If we however introduce the imaginary number i this equation has two solutions: x=i and x=-i.<br>If we go a step further the equation (x-3)<sup>2</sup>=-4 has two complex solutions: x=3+2i and x=3-2i.<br>x=3+2i and x=3-2i are called each others’ complex conjugate.<br>Numbers of the form a+bi are called complex numbers.<br>In general a+bi and a−bi are each other’s complex conjugate.</p>
<p>A Gaussian Integer is a complex number a+bi such that both a and b are integers.<br>The regular integers are also Gaussian integers (with b=0).<br>To distinguish them from Gaussian integers with b ≠ 0 we call such integers “rational integers.”<br>A Gaussian integer is called a divisor of a rational integer n if the result is also a Gaussian integer.<br>If for example we divide 5 by 1+2i we can simplify $\frac{5}{1+2i}$ in the following manner:<br>Multiply numerator and denominator by the complex conjugate of 1+2i: 1−2i.<br>The result is $\frac{5}{1+2i}=\frac{5}{1+2i}\frac{1-2i}{1-2i}=\frac{5(1-2i)}{1-(2i)^2}=\frac{5(1-2i)}{1-(-4)}=\frac{5(1-2i)}{5}=1-2i$.<br>So 1+2i is a divisor of 5.<br>Note that 1+i is not a divisor of 5 because $\frac{5}{1+i}=\frac{5}{2}-\frac{5}{2}i$.<br>Note also that if the Gaussian Integer (a+bi) is a divisor of a rational integer n, then its complex conjugate (a−bi) is also a divisor of n.</p>
<p>In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}.<br>The following is a table of all of the divisors for the first five positive rational integers:</p>
<table>
<thead>
<tr>
<th style="text-align:center">n</th>
<th style="text-align:center">Gaussian integer divisors with positive real part</th>
<th style="text-align:center">Sum s(n) of these divisors</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">1</td>
<td style="text-align:center">1</td>
<td style="text-align:center">1</td>
</tr>
<tr>
<td style="text-align:center">2</td>
<td style="text-align:center">1, 1+i, 1-i, 2</td>
<td style="text-align:center">5</td>
</tr>
<tr>
<td style="text-align:center">3</td>
<td style="text-align:center">1, 3</td>
<td style="text-align:center">4</td>
</tr>
<tr>
<td style="text-align:center">4</td>
<td style="text-align:center">1, 1+i, 1-i, 2, 2+2i, 2-2i,4</td>
<td style="text-align:center">13</td>
</tr>
<tr>
<td style="text-align:center">5</td>
<td style="text-align:center">1, 1+2i, 1-2i, 2+i, 2-i, 5</td>
<td style="text-align:center">12</td>
</tr>
</tbody>
</table>
<p>For divisors with positive real parts, then, we have: $\sum_{n=1}^{5}s(n)=35$.</p>
<p>For 1 ≤ n ≤ 10<sup>5</sup>, ∑ s(n)=17924657155.</p>
<p>What is ∑ s(n) for 1 ≤ n ≤ 10<sup>8</sup>?</p>
<hr>
<p><b>高斯整数的研究</b></p>
<p>我们都知道方程x<sup>2</sup>=-1在实数范围内无解。<br>但如果我们引入虚数i,这个方程将会有两个解x=i和x=-i。<br>进一步地,方程(x-3)<sup>2</sup>=-4有两个复数解:x=3+2i和x=3-2i。<br>x=3+2i和x=3-2i互称为共轭复数。<br>形如a+bi的数被称为复数。<br>概括地说,a+bi和a−bi互称为共轭复数。</p>
<p>高斯整数是形如a+bi且a和b均为整数的复数。<br>一般意义上的整数也是高斯整数(取b=0)。<br>为了把它们和b ≠ 0的高斯整数区分开来,称它们为“有理整数”。<br>如果一个高斯整数除有理整数n的结果仍然是高斯整数,则称它为该有理整数的约数。<br>例如,我们用1+2i除5,按如下方式简化$\frac{5}{1+2i}$:<br>分子和分母同时乘以1+2i的共轭:1−2i。<br>结果是:$\frac{5}{1+2i}=\frac{5}{1+2i}\frac{1-2i}{1-2i}=\frac{5(1-2i)}{1-(2i)^2}=\frac{5(1-2i)}{1-(-4)}=\frac{5(1-2i)}{5}=1-2i$。<br>所以1+2i是5的约数。<br>注意1+i不是5的约数,因为$\frac{5}{1+i}=\frac{5}{2}-\frac{5}{2}i$。<br>同时注意如果高斯整数(a+bi)是有理整数n的约数,那么它的共轭复数(a−bi)也是n的约数。</p>
<p>事实上,5一共有六个实数部分是正数的约数:{1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}。<br>如下表格列出了前五个正有理整数的所有约数:</p>
<table>
<thead>
<tr>
<th style="text-align:center">n</th>
<th style="text-align:center">实数部分是正数的高斯整数约数</th>
<th style="text-align:center">约数的和s(n)</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">1</td>
<td style="text-align:center">1</td>
<td style="text-align:center">1</td>
</tr>
<tr>
<td style="text-align:center">2</td>
<td style="text-align:center">1, 1+i, 1-i, 2</td>
<td style="text-align:center">5</td>
</tr>
<tr>
<td style="text-align:center">3</td>
<td style="text-align:center">1, 3</td>
<td style="text-align:center">4</td>
</tr>
<tr>
<td style="text-align:center">4</td>
<td style="text-align:center">1, 1+i, 1-i, 2, 2+2i, 2-2i,4</td>
<td style="text-align:center">13</td>
</tr>
<tr>
<td style="text-align:center">5</td>
<td style="text-align:center">1, 1+2i, 1-2i, 2+i, 2-i, 5</td>
<td style="text-align:center">12</td>
</tr>
</tbody>
</table>
<p>对于实数部分为正数的约数,我们有:$\sum_{n=1}^{5}s(n)=35$。</p>
<p>对于1 ≤ n ≤ 10<sup>5</sup>,∑ s(n)=17924657155。</p>
<p>对于1 ≤ n ≤ 10<sup>8</sup>,求∑ s(n)。</p>
<hr>
</div>
<div class="post-footer">
<div class="post-nav">
<div class="post-nav-prev post-nav-item">
<a href="/152/">Problem 152</a>
</div>
<div class="post-nav-next post-nav-item">
<a href="/154/">Problem 154</a>
</div>
</div>
</div>
</div>
<div class="post-spread">
</div>
<div class="comments" id="comments">
<div class="ds-thread" data-thread-key="153/"
data-title="Problem 153" data-url="http://yoursite.com/153/">
</div>
</div>
</div>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<div id="sidebar" class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
文章目录
</li>
<li class="sidebar-nav-overview" data-target="site-overview">
站点概览
</li>
</ul>
<div class="site-overview">
<div class="site-author motion-element">
<img class="site-author-image" src="/images/avatar.png" alt="sx349" />
<p class="site-author-name">Leonhard Euler(1707-1783)</p>
</div>
<p class="site-description motion-element"><br>Project Euler | 欧拉计划<br>中文翻译站</p>
<div class="links-of-author motion-element">
</div>
<div class="cc-license motion-element">
<a href="http://creativecommons.org/licenses/by-nc-sa/4.0" class="cc-opacity" target="_blank">
<img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
</a>
</div>
<div class="links-of-author motion-element">
<p class="site-author-name" style="font-size:14px">友情链接</p>
<span class="links-of-author-item">
<a href="https://projecteuler.net" target="_blank">Project Euler</a>
</span><br>
<span class="links-of-author-item">
<a href="http://pe.spiritzhang.com/" target="_blank">官方汉化</a>
</span><br>
<span class="links-of-author-item">
<a href="http://jakwings.is-programmer.com/Project_Euler" target="_blank">饮水思源汉化</a>
</span><br>
<span class="links-of-author-item">
<a href="http://sx349.github.io" target="_blank">译者博客</a>
</span><br>
</div>
</div>
<div class="post-toc-wrap sidebar-panel-active">
<div class="post-toc-indicator-top post-toc-indicator"></div>
<div class="post-toc">
<div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Problem_153"><span class="nav-number">1.</span> <span class="nav-text">Problem 153</span></a></li></ol></div>
</div>
<div class="post-toc-indicator-bottom post-toc-indicator"></div>
</div>
</div>
</div>
</div>
<div id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">
© 2015 -
2016
<span class="with-love"><i class="icon-heart"></i></span>
<span class="author"><a href="http://sx349.github.io">sx349</a></span>
</div>
<div class="powered-by">
由 <a class="theme-link" href="http://hexo.io">Hexo</a> 强力驱动
</div>
<div class="theme-info">
主题 -
<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
NexT.Mist
</a>by <a href="http://notes.iissnan.com/">IIssNan</a>
</div>
</div>
</div>
<div class="back-to-top"></div>
</div>
<script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="/js/fancy-box.js?v=0.4.3"></script>
<script type="text/javascript" src="/js/helpers.js?v=0.4.3"></script>
<script type="text/javascript" src="/vendors/velocity/velocity.min.js"></script>
<script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js"></script>
<script type="text/javascript" src="/js/motion_global.js?v=0.4.3" id="motion.global"></script>
<script type="text/javascript" src="/js/search-toggle.js"></script>
<script type="text/javascript" src="/js/bootstrap.scrollspy.js?v=0.4.3" id="bootstrap.scrollspy.custom"></script>
<script type="text/javascript" id="sidebar.toc.highlight">
$(document).ready(function () {
var tocSelector = '.post-toc';
var $tocSelector = $(tocSelector);
var activeCurrentSelector = '.active-current';
$tocSelector
.on('activate.bs.scrollspy', function () {
var $currentActiveElement = $(tocSelector + ' .active').last();
removeCurrentActiveClass();
$currentActiveElement.addClass('active-current');
$tocSelector[0].scrollTop = $currentActiveElement.position().top;
})
.on('clear.bs.scrollspy', function () {
removeCurrentActiveClass();
});
function removeCurrentActiveClass () {
$(tocSelector + ' ' + activeCurrentSelector)
.removeClass(activeCurrentSelector.substring(1));
}
function processTOC () {
getTOCMaxHeight();
toggleTOCOverflowIndicators();
}
function getTOCMaxHeight () {
var $sidebarInner = $('.sidebar-inner');
var height = $('.sidebar').height() -
$tocSelector.position().top -
$('.post-toc-indicator-bottom').height();
$tocSelector.css('height', height);
return height;
}
function toggleTOCOverflowIndicators () {
tocOverflowIndicator(
'.post-toc-indicator-top',
$tocSelector.scrollTop() > 0 ? 'show' : 'hide'
);
tocOverflowIndicator(
'.post-toc-indicator-bottom',
$tocSelector.scrollTop() >= $tocSelector.find('ol').height() - $tocSelector.height() ? 'hide' : 'show'
)
}
$(document).on('sidebar.didShow', function () {
processTOC();
});
$('body').scrollspy({ target: tocSelector });
$(window).on('resize', function () {
if ( $('.sidebar').hasClass('sidebar-active') ) {
processTOC();
}
});
onScroll($tocSelector);
function onScroll (element) {
element.on('mousewheel DOMMouseScroll', function (event) {
var oe = event.originalEvent;
var delta = oe.wheelDelta || -oe.detail;
var self = this;
this.scrollTop += ( delta < 0 ? 1 : -1 ) * 30;
event.preventDefault();
toggleTOCOverflowIndicators();
});
}
function tocOverflowIndicator (indicator, action) {
$(indicator).velocity('stop').velocity({
opacity: action === 'show' ? 0.4 : 0
}, { duration: 100 });
}
});
</script>
<script type="text/javascript" id="sidebar.nav">
$(document).ready(function () {
var html = $('html');
$('.sidebar-nav li').on('click', function () {
var item = $(this);
var activeTabClassName = 'sidebar-nav-active';
var activePanelClassName = 'sidebar-panel-active';
if (item.hasClass(activeTabClassName)) {
return;
}
var currentTarget = $('.' + activePanelClassName);
var target = $('.' + item.data('target'));
currentTarget.velocity('transition.slideUpOut', 200, function () {
target
.velocity('stop')
.velocity('transition.slideDownIn', 200)
.addClass(activePanelClassName);
});
item.siblings().removeClass(activeTabClassName);
item.addClass(activeTabClassName);
});
$('.post-toc a').on('click', function (e) {
e.preventDefault();
var offset = $(escapeSelector(this.getAttribute('href'))).offset().top;
html.velocity('stop').velocity('scroll', {
offset: offset + 'px',
mobileHA: false
});
});
// Expand sidebar on post detail page by default, when post has a toc.
var $tocContent = $('.post-toc-content');
if (isDesktop() && CONFIG.sidebar === 'post') {
if ($tocContent.length > 0 && $tocContent.html().trim().length > 0) {
displaySidebar();
}
}
});
</script>
<script type="text/javascript">
$(document).ready(function () {
if (CONFIG.sidebar === 'always') {
displaySidebar();
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript">
var duoshuoQuery = {short_name:"sx349"};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<script type="text/javascript" src="/js/analytics_google-analytics.js?v=0.4.3"></script>
</body>
</html>