-
Notifications
You must be signed in to change notification settings - Fork 1
/
problems.html
8847 lines (7633 loc) · 804 KB
/
problems.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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!-- saved from url=(0033)https://projecteuler.net/show=all -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="author" content="Colin Hughes">
<meta name="description" content="A website dedicated to the fascinating world of mathematics and programming">
<meta name="keywords" content="programming,mathematics,problems,puzzles">
<title>Problems - Project Euler</title>
<link rel="shortcut icon" href="https://projecteuler.net/favicon.ico">
<link rel="stylesheet" type="text/css" href="./problems_files/style_main.css">
<link rel="stylesheet" type="text/css" href="./problems_files/style_light.css">
<script type="text/x-mathjax-config;executed=true">
MathJax.Hub.Config({
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ["$","$"], ["\\(","\\)"] ],
displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="./problems_files/MathJax.js">
</script>
<style type="text/css"></style><style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 5px 0px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 1px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuRadioCheck {position: absolute; left: .7em}
.MathJax_MenuLabel {padding: 1px 2em 3px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #DDDDDD; margin: 4px 3px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: #606872; color: white}
.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><style type="text/css">.MathJax_Display {text-align: center; margin: 1em 0em; position: relative; display: block; width: 100%}
.MathJax .merror {background-color: #FFFF88; color: #CC0000; border: 1px solid #CC0000; padding: 1px 3px; font-style: normal; font-size: 90%}
#MathJax_Tooltip {background-color: InfoBackground; color: InfoText; border: 1px solid black; box-shadow: 2px 2px 5px #AAAAAA; -webkit-box-shadow: 2px 2px 5px #AAAAAA; -moz-box-shadow: 2px 2px 5px #AAAAAA; -khtml-box-shadow: 2px 2px 5px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true'); padding: 3px 4px; z-index: 401; position: absolute; left: 0; top: 0; width: auto; height: auto; display: none}
.MathJax {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; border: 0; padding: 0; margin: 0}
.MathJax img, .MathJax nobr, .MathJax a {border: 0; padding: 0; margin: 0; max-width: none; max-height: none; vertical-align: 0; line-height: normal; text-decoration: none}
img.MathJax_strut {border: 0 !important; padding: 0 !important; margin: 0 !important; vertical-align: 0 !important}
.MathJax span {display: inline; position: static; border: 0; padding: 0; margin: 0; vertical-align: 0; line-height: normal; text-decoration: none}
.MathJax nobr {white-space: nowrap ! important}
.MathJax img {display: inline ! important; float: none ! important}
.MathJax * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}
.MathJax_Processing {visibility: hidden; position: fixed; width: 0; height: 0; overflow: hidden}
.MathJax_Processed {display: none!important}
.MathJax_ExBox {display: block; overflow: hidden; width: 1px; height: 60ex}
.MathJax .MathJax_EmBox {display: block; overflow: hidden; width: 1px; height: 60em}
.MathJax .MathJax_HitBox {cursor: text; background: white; opacity: 0; filter: alpha(opacity=0)}
.MathJax .MathJax_HitBox * {filter: none; opacity: 1; background: transparent}
#MathJax_Tooltip * {filter: none; opacity: 1; background: transparent}
@font-face {font-family: MathJax_Main; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf') format('opentype')}
@font-face {font-family: MathJax_Main; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf') format('opentype'); font-weight: bold}
@font-face {font-family: MathJax_Main; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf') format('opentype'); font-style: italic}
@font-face {font-family: MathJax_Math; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf') format('opentype'); font-style: italic}
@font-face {font-family: MathJax_Caligraphic; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf') format('opentype')}
@font-face {font-family: MathJax_Size1; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf') format('opentype')}
@font-face {font-family: MathJax_Size2; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf') format('opentype')}
@font-face {font-family: MathJax_Size3; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf') format('opentype')}
@font-face {font-family: MathJax_Size4; src: url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff') format('woff'), url('https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf') format('opentype')}
.MathJax .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
</style></head>
<body cz-shortcut-listen="true"><div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_Hidden"></div></div><div id="MathJax_Message" style="display: none;"></div>
<div id="container">
<div id="nav" class="noprint">
<ul>
<li><a href="https://projecteuler.net/about" title="About" accesskey="h">About</a></li>
<li><a href="https://projecteuler.net/register" title="Register" accesskey="1">Register</a></li>
<li id="current"><a href="https://projecteuler.net/problems" title="Problems" accesskey="2">Problems</a></li>
<li><a href="https://projecteuler.net/login" title="Login" accesskey="3">Login</a></li>
</ul>
</div>
<div id="info_panel"><a href="https://projecteuler.net/rss2_euler.xml"><img src="./problems_files/icon_rss.png" alt="RSS Feed" title="RSS Feed"></a><a href="https://projecteuler.net/secure=b0b05"><img src="./problems_files/icon_unlock.png" alt="Do not use secure connection" title="Do not use secure connection"></a></div>
<div id="logo" class="noprint">
<img src="./problems_files/pe_banner_light.png" alt="Project Euler .net">
</div>
<div id="content">
<div style="text-align:center;" class="print"><img src="./problems_files/pe_banner.png" alt="projecteuler.net"></div>
<br><h3><a href="https://projecteuler.net/problem=1">Problem 1: Multiples of 3 and 5</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
<p>Find the sum of all the multiples of 3 or 5 below 1000.</p>
</div><h3><a href="https://projecteuler.net/problem=2">Problem 2: Even Fibonacci numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:</p>
<p style="text-align:center;">1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...</p>
<p>By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.</p>
<!--
Note: This problem has been changed recently, please check that you are using the right parameters.
-->
</div><h3><a href="https://projecteuler.net/problem=3">Problem 3: Largest prime factor</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The prime factors of 13195 are 5, 7, 13 and 29.</p>
<p>What is the largest prime factor of the number 600851475143 ?</p>
<!--
Note: This problem has been changed recently, please check that you are using the right number.
-->
</div><h3><a href="https://projecteuler.net/problem=4">Problem 4: Largest palindrome product</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 99.</p>
<p>Find the largest palindrome made from the product of two 3-digit numbers.</p>
</div><h3><a href="https://projecteuler.net/problem=5">Problem 5: Smallest multiple</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.</p>
<p>What is the smallest positive number that is <dfn title="divisible with no remainder">evenly divisible</dfn> by all of the numbers from 1 to 20?</p>
</div><h3><a href="https://projecteuler.net/problem=6">Problem 6: Sum square difference</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The sum of the squares of the first ten natural numbers is,</p>
<div style="text-align:center">1<sup>2</sup> + 2<sup>2</sup> + ... + 10<sup>2</sup> = 385</div>
<p>The square of the sum of the first ten natural numbers is,</p>
<div style="text-align:center">(1 + 2 + ... + 10)<sup>2</sup> = 55<sup>2</sup> = 3025</div>
<p>Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;"> 385 = 2640.</p>
<p>Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.</p>
</div><h3><a href="https://projecteuler.net/problem=7">Problem 7: 10001st prime</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.</p>
<p>What is the 10 001st prime number?</p>
</div><h3><a href="https://projecteuler.net/problem=8">Problem 8: Largest product in a series</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Find the greatest product of five consecutive digits in the 1000-digit number.</p>
<p style="font-family:courier new;font-size:10pt;text-align:center;">
73167176531330624919225119674426574742355349194934<br>
96983520312774506326239578318016984801869478851843<br>
85861560789112949495459501737958331952853208805511<br>
12540698747158523863050715693290963295227443043557<br>
66896648950445244523161731856403098711121722383113<br>
62229893423380308135336276614282806444486645238749<br>
30358907296290491560440772390713810515859307960866<br>
70172427121883998797908792274921901699720888093776<br>
65727333001053367881220235421809751254540594752243<br>
52584907711670556013604839586446706324415722155397<br>
53697817977846174064955149290862569321978468622482<br>
83972241375657056057490261407972968652414535100474<br>
82166370484403199890008895243450658541227588666881<br>
16427171479924442928230863465674813919123162824586<br>
17866458359124566529476545682848912883142607690042<br>
24219022671055626321111109370544217506941658960408<br>
07198403850962455444362981230987879927244284909188<br>
84580156166097919133875499200524063689912560717606<br>
05886116467109405077541002256983155200055935729725<br>
71636269561882670428252483600823257530420752963450<br>
</p>
</div><h3><a href="https://projecteuler.net/problem=9">Problem 9: Special Pythagorean triplet</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>A Pythagorean triplet is a set of three natural numbers, <var>a</var> <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> <var>b</var> <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> <var>c</var>, for which,</p>
<div style="text-align:center;"> <var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup></div>
<p>For example, 3<sup>2</sup> + 4<sup>2</sup> = 9 + 16 = 25 = 5<sup>2</sup>.</p>
<p>There exists exactly one Pythagorean triplet for which <var>a</var> + <var>b</var> + <var>c</var> = 1000.<br>Find the product <var>abc</var>.</p>
</div><h3><a href="https://projecteuler.net/problem=10">Problem 10: Summation of primes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.</p>
<p>Find the sum of all the primes below two million.</p>
<!--
<p class="info">Note: This problem has been changed recently, please check that you are using the right parameters.</p>
-->
</div><h3><a href="https://projecteuler.net/problem=11">Problem 11: Largest product in a grid</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>In the 20<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">20 grid below, four numbers along a diagonal line have been marked in red.</p>
<p style="font-family:courier new;text-align:center;font-size:10pt;">
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08<br>
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00<br>
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65<br>
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91<br>
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80<br>
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50<br>
32 98 81 28 64 23 67 10 <span style="color:#ff0000;"><b>26</b></span> 38 40 67 59 54 70 66 18 38 64 70<br>
67 26 20 68 02 62 12 20 95 <span style="color:#ff0000;"><b>63</b></span> 94 39 63 08 40 91 66 49 94 21<br>
24 55 58 05 66 73 99 26 97 17 <span style="color:#ff0000;"><b>78</b></span> 78 96 83 14 88 34 89 63 72<br>
21 36 23 09 75 00 76 44 20 45 35 <span style="color:#ff0000;"><b>14</b></span> 00 61 33 97 34 31 33 95<br>
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92<br>
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57<br>
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58<br>
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40<br>
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66<br>
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69<br>
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36<br>
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16<br>
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54<br>
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48<br>
</p>
<p>The product of these numbers is 26 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 63 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 78 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 14 = 1788696.</p>
<p>What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">20 grid?</p>
</div><h3><a href="https://projecteuler.net/problem=12">Problem 12: Highly divisible triangular number</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The sequence of triangle numbers is generated by adding the natural numbers. So the 7<sup>th</sup> triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:</p>
<p style="text-align:center;">1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...</p>
<p>Let us list the factors of the first seven triangle numbers:</p>
<blockquote style="font-family:courier new;"><b> 1</b>: 1<br>
<b> 3</b>: 1,3<br>
<b> 6</b>: 1,2,3,6<br>
<b>10</b>: 1,2,5,10<br>
<b>15</b>: 1,3,5,15<br>
<b>21</b>: 1,3,7,21<br>
<b>28</b>: 1,2,4,7,14,28</blockquote>
<p>We can see that 28 is the first triangle number to have over five divisors.</p>
<p>What is the value of the first triangle number to have over five hundred divisors?</p>
</div><h3><a href="https://projecteuler.net/problem=13">Problem 13: Large sum</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.</p>
<div style="font-family:courier new;font-size:10pt;text-align:center;">
37107287533902102798797998220837590246510135740250<br>
46376937677490009712648124896970078050417018260538<br>
74324986199524741059474233309513058123726617309629<br>
91942213363574161572522430563301811072406154908250<br>
23067588207539346171171980310421047513778063246676<br>
89261670696623633820136378418383684178734361726757<br>
28112879812849979408065481931592621691275889832738<br>
44274228917432520321923589422876796487670272189318<br>
47451445736001306439091167216856844588711603153276<br>
70386486105843025439939619828917593665686757934951<br>
62176457141856560629502157223196586755079324193331<br>
64906352462741904929101432445813822663347944758178<br>
92575867718337217661963751590579239728245598838407<br>
58203565325359399008402633568948830189458628227828<br>
80181199384826282014278194139940567587151170094390<br>
35398664372827112653829987240784473053190104293586<br>
86515506006295864861532075273371959191420517255829<br>
71693888707715466499115593487603532921714970056938<br>
54370070576826684624621495650076471787294438377604<br>
53282654108756828443191190634694037855217779295145<br>
36123272525000296071075082563815656710885258350721<br>
45876576172410976447339110607218265236877223636045<br>
17423706905851860660448207621209813287860733969412<br>
81142660418086830619328460811191061556940512689692<br>
51934325451728388641918047049293215058642563049483<br>
62467221648435076201727918039944693004732956340691<br>
15732444386908125794514089057706229429197107928209<br>
55037687525678773091862540744969844508330393682126<br>
18336384825330154686196124348767681297534375946515<br>
80386287592878490201521685554828717201219257766954<br>
78182833757993103614740356856449095527097864797581<br>
16726320100436897842553539920931837441497806860984<br>
48403098129077791799088218795327364475675590848030<br>
87086987551392711854517078544161852424320693150332<br>
59959406895756536782107074926966537676326235447210<br>
69793950679652694742597709739166693763042633987085<br>
41052684708299085211399427365734116182760315001271<br>
65378607361501080857009149939512557028198746004375<br>
35829035317434717326932123578154982629742552737307<br>
94953759765105305946966067683156574377167401875275<br>
88902802571733229619176668713819931811048770190271<br>
25267680276078003013678680992525463401061632866526<br>
36270218540497705585629946580636237993140746255962<br>
24074486908231174977792365466257246923322810917141<br>
91430288197103288597806669760892938638285025333403<br>
34413065578016127815921815005561868836468420090470<br>
23053081172816430487623791969842487255036638784583<br>
11487696932154902810424020138335124462181441773470<br>
63783299490636259666498587618221225225512486764533<br>
67720186971698544312419572409913959008952310058822<br>
95548255300263520781532296796249481641953868218774<br>
76085327132285723110424803456124867697064507995236<br>
37774242535411291684276865538926205024910326572967<br>
23701913275725675285653248258265463092207058596522<br>
29798860272258331913126375147341994889534765745501<br>
18495701454879288984856827726077713721403798879715<br>
38298203783031473527721580348144513491373226651381<br>
34829543829199918180278916522431027392251122869539<br>
40957953066405232632538044100059654939159879593635<br>
29746152185502371307642255121183693803580388584903<br>
41698116222072977186158236678424689157993532961922<br>
62467957194401269043877107275048102390895523597457<br>
23189706772547915061505504953922979530901129967519<br>
86188088225875314529584099251203829009407770775672<br>
11306739708304724483816533873502340845647058077308<br>
82959174767140363198008187129011875491310547126581<br>
97623331044818386269515456334926366572897563400500<br>
42846280183517070527831839425882145521227251250327<br>
55121603546981200581762165212827652751691296897789<br>
32238195734329339946437501907836945765883352399886<br>
75506164965184775180738168837861091527357929701337<br>
62177842752192623401942399639168044983993173312731<br>
32924185707147349566916674687634660915035914677504<br>
99518671430235219628894890102423325116913619626622<br>
73267460800591547471830798392868535206946944540724<br>
76841822524674417161514036427982273348055556214818<br>
97142617910342598647204516893989422179826088076852<br>
87783646182799346313767754307809363333018982642090<br>
10848802521674670883215120185883543223812876952786<br>
71329612474782464538636993009049310363619763878039<br>
62184073572399794223406235393808339651327408011116<br>
66627891981488087797941876876144230030984490851411<br>
60661826293682836764744779239180335110989069790714<br>
85786944089552990653640447425576083659976645795096<br>
66024396409905389607120198219976047599490197230297<br>
64913982680032973156037120041377903785566085089252<br>
16730939319872750275468906903707539413042652315011<br>
94809377245048795150954100921645863754710598436791<br>
78639167021187492431995700641917969777599028300699<br>
15368713711936614952811305876380278410754449733078<br>
40789923115535562561142322423255033685442488917353<br>
44889911501440648020369068063960672322193204149535<br>
41503128880339536053299340368006977710650566631954<br>
81234880673210146739058568557934581403627822703280<br>
82616570773948327592232845941706525094512325230608<br>
22918802058777319719839450180888072429661980811197<br>
77158542502016545090413245809786882778948721859617<br>
72107838435069186155435662884062257473692284509516<br>
20849603980134001723930671666823555245252804609722<br>
53503534226472524250874054075591789781264330331690<br>
</div>
</div><h3><a href="https://projecteuler.net/problem=14">Problem 14: Longest Collatz sequence</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The following iterative sequence is defined for the set of positive integers:</p>
<p style="margin-left:50px;"><var>n</var> <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> <var>n</var>/2 (<var>n</var> is even)<br>
<var>n</var> <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 3<var>n</var> + 1 (<var>n</var> is odd)</p>
<p>Using the rule above and starting with 13, we generate the following sequence:</p>
<div style="text-align:center;">13 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 40 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 20 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 10 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 5 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 16 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 8 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 4 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 2 <img src="./problems_files/symbol_maps.gif" width="15" height="7" alt="→" border="0" style="vertical-align:middle;"> 1</div>
<p>It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.</p>
<p>Which starting number, under one million, produces the longest chain?</p>
<p class="info"><b>NOTE:</b> Once the chain starts the terms are allowed to go above one million.</p>
</div><h3><a href="https://projecteuler.net/problem=15">Problem 15: Lattice paths</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Starting in the top left corner of a 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.</p>
<div style="text-align:center;">
<img src="./problems_files/p_015.gif" alt="">
</div>
<p>How many such routes are there through a 20<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">20 grid?</p>
</div><h3><a href="https://projecteuler.net/problem=16">Problem 16: Power digit sum</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>2<sup>15</sup> = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.</p>
<p>What is the sum of the digits of the number 2<sup>1000</sup>?</p>
</div><h3><a href="https://projecteuler.net/problem=17">Problem 17: Number letter counts</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.</p>
<p>If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? </p>
<br>
<p class="info"><b>NOTE:</b> Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.</p>
</div><h3><a href="https://projecteuler.net/problem=18">Problem 18: Maximum path sum I</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.</p>
<p style="text-align:center;font-family:courier new;font-size:12pt;"><span style="color:#ff0000;"><b>3</b></span><br>
<span style="color:#ff0000;"><b>7</b></span> 4<br>
2 <span style="color:#ff0000;"><b>4</b></span> 6<br>
8 5 <span style="color:#ff0000;"><b>9</b></span> 3</p>
<p>That is, 3 + 7 + 4 + 9 = 23.</p>
<p>Find the maximum total from top to bottom of the triangle below:</p>
<p style="text-align:center;font-family:courier new;">75<br>
95 64<br>
17 47 82<br>
18 35 87 10<br>
20 04 82 47 65<br>
19 01 23 75 03 34<br>
88 02 77 73 07 63 67<br>
99 65 04 28 06 16 70 92<br>
41 41 26 56 83 40 80 70 33<br>
41 48 72 33 47 32 37 16 94 29<br>
53 71 44 65 25 43 91 52 97 51 14<br>
70 11 33 28 77 73 17 78 39 68 17 57<br>
91 71 52 38 17 14 91 43 58 50 27 29 48<br>
63 66 04 68 89 53 67 30 73 16 69 87 40 31<br>
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23</p>
<p class="info"><b>NOTE:</b> As there are only 16384 routes, it is possible to solve this problem by trying every route. However, <a href="https://projecteuler.net/index.php?section=problems&id=67">Problem 67</a>, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)</p>
</div><h3><a href="https://projecteuler.net/problem=19">Problem 19: Counting Sundays</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>You are given the following information, but you may prefer to do some research for yourself.</p>
<ul>
<li>1 Jan 1900 was a Monday.</li>
<li>Thirty days has September,<br>
April, June and November.<br>
All the rest have thirty-one,<br>
Saving February alone,<br>
Which has twenty-eight, rain or shine.<br>
And on leap years, twenty-nine.</li>
<li>A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.</li>
</ul>
<p>How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?</p>
</div><h3><a href="https://projecteuler.net/problem=20">Problem 20: Factorial digit sum</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p><i>n</i>! means <i>n</i> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> (<i>n</i> <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;"> 1) <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> ... <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 3 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 2 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 1</p>
<p>For example, 10! = 10 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 9 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> ... <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 3 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 2 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 1 = 3628800,<br>and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.</p>
<p>Find the sum of the digits in the number 100!</p>
</div><h3><a href="https://projecteuler.net/problem=21">Problem 21: Amicable numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Let d(<i>n</i>) be defined as the sum of proper divisors of <i>n</i> (numbers less than <i>n</i> which divide evenly into <i>n</i>).<br>
If d(<i>a</i>) = <i>b</i> and d(<i>b</i>) = <i>a</i>, where <i>a</i> <img src="./problems_files/symbol_ne.gif" width="11" height="10" alt="≠" border="0" style="vertical-align:middle;"> <i>b</i>, then <i>a</i> and <i>b</i> are an amicable pair and each of <i>a</i> and <i>b</i> are called amicable numbers.</p>
<p>For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.</p>
<p>Evaluate the sum of all the amicable numbers under 10000.</p>
</div><h3><a href="https://projecteuler.net/problem=22">Problem 22: Names scores</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Using <a href="https://projecteuler.net/project/names.txt">names.txt</a> (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.</p>
<p>For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 53 = 49714.</p>
<p>What is the total of all the name scores in the file?</p>
</div><h3><a href="https://projecteuler.net/problem=23">Problem 23: Non-abundant sums</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.</p>
<p>A number <var>n</var> is called deficient if the sum of its proper divisors is less than <var>n</var> and it is called abundant if this sum exceeds <var>n</var>.</p>
<!-- <p>A number whose proper divisors are less than the number is called deficient and a number whose proper divisors exceed the number is called abundant.</p> -->
<p>As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the smallest number that can be written as the sum of two abundant numbers is 24. By mathematical analysis, it can be shown that all integers greater than 28123 can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.</p>
<p>Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.</p>
</div><h3><a href="https://projecteuler.net/problem=24">Problem 24: Lexicographic permutations</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:</p>
<p style="text-align:center;">012 021 102 120 201 210</p>
<p>What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?</p>
</div><h3><a href="https://projecteuler.net/problem=25">Problem 25: 1000-digit Fibonacci number</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The Fibonacci sequence is defined by the recurrence relation:</p>
<blockquote>F<sub><i>n</i></sub> = F<sub><i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1</sub> + F<sub><i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">2</sub>, where F<sub>1</sub> = 1 and F<sub>2</sub> = 1.</blockquote>
<p>Hence the first 12 terms will be:</p>
<blockquote>F<sub>1</sub> = 1<br>
F<sub>2</sub> = 1<br>
F<sub>3</sub> = 2<br>
F<sub>4</sub> = 3<br>
F<sub>5</sub> = 5<br>
F<sub>6</sub> = 8<br>
F<sub>7</sub> = 13<br>
F<sub>8</sub> = 21<br>
F<sub>9</sub> = 34<br>
F<sub>10</sub> = 55<br>
F<sub>11</sub> = 89<br>
F<sub>12</sub> = 144</blockquote>
<p>The 12th term, F<sub>12</sub>, is the first term to contain three digits.</p>
<p>What is the first term in the Fibonacci sequence to contain 1000 digits?</p>
</div><h3><a href="https://projecteuler.net/problem=26">Problem 26: Reciprocal cycles</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:</p>
<blockquote>
<table>
<tbody><tr>
<td><sup>1</sup>/<sub>2</sub></td><td>= </td><td>0.5</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>3</sub></td><td>= </td><td>0.(3)</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>4</sub></td><td>= </td><td>0.25</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>5</sub></td><td>= </td><td>0.2</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>6</sub></td><td>= </td><td>0.1(6)</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>7</sub></td><td>= </td><td>0.(142857)</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>8</sub></td><td>= </td><td>0.125</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>9</sub></td><td>= </td><td>0.(1)</td>
</tr>
<tr>
<td><sup>1</sup>/<sub>10</sub></td><td>= </td><td>0.1</td>
</tr>
</tbody></table>
</blockquote>
<p>Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that <sup>1</sup>/<sub>7</sub> has a 6-digit recurring cycle.</p>
<p>Find the value of <i>d</i> <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> 1000 for which <sup>1</sup>/<sub><i>d</i></sub> contains the longest recurring cycle in its decimal fraction part.</p>
</div><h3><a href="https://projecteuler.net/problem=27">Problem 27: Quadratic primes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Euler discovered the remarkable quadratic formula:</p>
<p style="text-align:center;"><i>n</i>² + <i>n</i> + 41</p>
<p>It turns out that the formula will produce 40 primes for the consecutive values <i>n</i> = 0 to 39. However, when <i>n</i> = 40, 40<sup>2</sup> + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when <i>n</i> = 41, 41² + 41 + 41 is clearly divisible by 41.</p>
<p>The incredible formula <i>n</i>² <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;"> 79<i>n</i> + 1601 was discovered, which produces 80 primes for the consecutive values <i>n</i> = 0 to 79. The product of the coefficients, <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">79 and 1601, is <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">126479.</p>
<p>Considering quadratics of the form:</p>
<blockquote>
<i>n</i>² + <i>an</i> + <i>b</i>, where |<i>a</i>| <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> 1000 and |<i>b</i>| <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> 1000<br><br>
<div class="info" style="text-align:left;">where |<i>n</i>| is the modulus/absolute value of <i>n</i><br>e.g. |11| = 11 and |<img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">4| = 4</div>
</blockquote>
<p>Find the product of the coefficients, <i>a</i> and <i>b</i>, for the quadratic expression that produces the maximum number of primes for consecutive values of <i>n</i>, starting with <i>n</i> = 0.</p>
</div><h3><a href="https://projecteuler.net/problem=28">Problem 28: Number spiral diagonals</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:</p>
<p style="text-align:center;font-family:courier new;"><span style="color:#ff0000;font-family:courier new;"><b>21</b></span> 22 23 24 <span style="color:#ff0000;font-family:courier new;"><b>25</b></span><br>
20 <span style="color:#ff0000;font-family:courier new;"><b>7</b></span> 8 <span style="color:#ff0000;font-family:courier new;"><b>9</b></span> 10<br>
19 6 <span style="color:#ff0000;font-family:courier new;"><b>1</b></span> 2 11<br>
18 <span style="color:#ff0000;font-family:courier new;"><b>5</b></span> 4 <span style="color:#ff0000;font-family:courier new;"><b>3</b></span> 12<br>
<span style="color:#ff0000;font-family:courier new;"><b>17</b></span> 16 15 14 <span style="color:#ff0000;font-family:courier new;"><b>13</b></span></p>
<p>It can be verified that the sum of the numbers on the diagonals is 101.</p>
<p>What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?</p>
</div><h3><a href="https://projecteuler.net/problem=29">Problem 29: Distinct powers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Consider all integer combinations of <i>a</i><sup><i>b</i></sup> for 2 <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <i>a</i> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 5 and 2 <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <i>b</i> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 5:</p>
<blockquote>2<sup>2</sup>=4, 2<sup>3</sup>=8, 2<sup>4</sup>=16, 2<sup>5</sup>=32<br>
3<sup>2</sup>=9, 3<sup>3</sup>=27, 3<sup>4</sup>=81, 3<sup>5</sup>=243<br>
4<sup>2</sup>=16, 4<sup>3</sup>=64, 4<sup>4</sup>=256, 4<sup>5</sup>=1024<br>
5<sup>2</sup>=25, 5<sup>3</sup>=125, 5<sup>4</sup>=625, 5<sup>5</sup>=3125<br></blockquote>
<p>If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:</p>
<p style="text-align:center;">4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125</p>
<p>How many distinct terms are in the sequence generated by <i>a</i><sup><i>b</i></sup> for 2 <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <i>a</i> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 100 and 2 <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <i>b</i> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 100?</p>
</div><h3><a href="https://projecteuler.net/problem=30">Problem 30: Digit fifth powers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:</p>
<blockquote>1634 = 1<sup>4</sup> + 6<sup>4</sup> + 3<sup>4</sup> + 4<sup>4</sup><br>
8208 = 8<sup>4</sup> + 2<sup>4</sup> + 0<sup>4</sup> + 8<sup>4</sup><br>
9474 = 9<sup>4</sup> + 4<sup>4</sup> + 7<sup>4</sup> + 4<sup>4</sup></blockquote>
<p class="info">As 1 = 1<sup>4</sup> is not a sum it is not included.</p>
<p>The sum of these numbers is 1634 + 8208 + 9474 = 19316.</p>
<p>Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.</p>
</div><h3><a href="https://projecteuler.net/problem=31">Problem 31: Coin sums</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:</p>
<blockquote>1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).</blockquote>
<p>It is possible to make £2 in the following way:</p>
<blockquote>1<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">£1 + 1<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">50p + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">20p + 1<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">5p + 1<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">2p + 3<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">1p</blockquote>
<p>How many different ways can £2 be made using any number of coins?</p>
</div><h3><a href="https://projecteuler.net/problem=32">Problem 32: Pandigital products</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>We shall say that an <var>n</var>-digit number is pandigital if it makes use of all the digits 1 to <var>n</var> exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.</p>
<p>The product 7254 is unusual, as the identity, 39 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.</p>
<p>Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.</p>
<div class="info">HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.</div>
</div><h3><a href="https://projecteuler.net/problem=33">Problem 33: Digit canceling fractions</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The fraction <sup>49</sup>/<sub>98</sub> is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that <sup>49</sup>/<sub>98</sub> = <sup>4</sup>/<sub>8</sub>, which is correct, is obtained by cancelling the 9s.</p>
<p>We shall consider fractions like, <sup>30</sup>/<sub>50</sub> = <sup>3</sup>/<sub>5</sub>, to be trivial examples.</p>
<p>There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.</p>
<p>If the product of these four fractions is given in its lowest common terms, find the value of the denominator.</p>
</div><h3><a href="https://projecteuler.net/problem=34">Problem 34: Digit factorials</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.</p>
<p>Find the sum of all numbers which are equal to the sum of the factorial of their digits.</p>
<p class="info">Note: as 1! = 1 and 2! = 2 are not sums they are not included.</p>
</div><h3><a href="https://projecteuler.net/problem=35">Problem 35: Circular primes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.</p>
<p>There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.</p>
<p>How many circular primes are there below one million?</p>
</div><h3><a href="https://projecteuler.net/problem=36">Problem 36: Double-base palindromes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The decimal number, 585 = 1001001001<sub>2</sub> (binary), is palindromic in both bases.</p>
<p>Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.</p>
<p class="info">(Please note that the palindromic number, in either base, may not include leading zeros.)</p>
</div><h3><a href="https://projecteuler.net/problem=37">Problem 37: Truncatable primes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.</p>
<p>Find the sum of the only eleven primes that are both truncatable from left to right and right to left.</p>
<p class="info">NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.</p>
</div><h3><a href="https://projecteuler.net/problem=38">Problem 38: Pandigital multiples</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Take the number 192 and multiply it by each of 1, 2, and 3:</p>
<blockquote>192 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 1 = 192<br>
192 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 2 = 384<br>
192 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 3 = 576</blockquote>
<p>By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1,2,3)</p>
<p>The same can be achieved by starting with 9 and multiplying by 1, 2, 3, 4, and 5, giving the pandigital, 918273645, which is the concatenated product of 9 and (1,2,3,4,5).</p>
<p>What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , <var>n</var>) where <var>n</var> <img src="./problems_files/symbol_gt.gif" width="10" height="10" alt=">" border="0" style="vertical-align:middle;"> 1?</p>
</div><h3><a href="https://projecteuler.net/problem=39">Problem 39: Integer right triangles</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>If <i>p</i> is the perimeter of a right angle triangle with integral length sides, {<i>a</i>,<i>b</i>,<i>c</i>}, there are exactly three solutions for <i>p</i> = 120.</p>
<p style="\'text-align:center;\'">{20,48,52}, {24,45,51}, {30,40,50}</p>
<p>For which value of <i>p</i> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 1000, is the number of solutions maximised?</p>
</div><h3><a href="https://projecteuler.net/problem=40">Problem 40: Champernowne's constant</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>An irrational decimal fraction is created by concatenating the positive integers:</p>
<p style="text-align:center;">0.12345678910<span style="color:#dd0000;font-size:14pt;">1</span>112131415161718192021...</p>
<p>It can be seen that the 12<sup>th</sup> digit of the fractional part is 1.</p>
<p>If <i>d</i><sub><i>n</i></sub> represents the <i>n</i><sup>th</sup> digit of the fractional part, find the value of the following expression.</p>
<p style="text-align:center;"><i>d</i><sub>1</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>10</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>100</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>1000</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>10000</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>100000</sub> <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> <i>d</i><sub>1000000</sub></p>
</div><h3><a href="https://projecteuler.net/problem=41">Problem 41: Pandigital prime</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>We shall say that an <i>n</i>-digit number is pandigital if it makes use of all the digits 1 to <i>n</i> exactly once. For example, 2143 is a 4-digit pandigital and is also prime.</p>
<p>What is the largest <i>n</i>-digit pandigital prime that exists?</p>
</div><h3><a href="https://projecteuler.net/problem=42">Problem 42: Coded triangle numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The <i>n</i><sup>th</sup> term of the sequence of triangle numbers is given by, <i>t<sub>n</sub></i> = ½<i>n</i>(<i>n</i>+1); so the first ten triangle numbers are:</p>
<p style="text-align:center;">1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...</p>
<p>By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = <i>t</i><sub>10</sub>. If the word value is a triangle number then we shall call the word a triangle word.</p>
<p>Using <a href="https://projecteuler.net/project/words.txt">words.txt</a> (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words, how many are triangle words?</p>
</div><h3><a href="https://projecteuler.net/problem=43">Problem 43: Sub-string divisibility</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property.</p>
<p>Let <i>d</i><sub>1</sub> be the 1<sup>st</sup> digit, <i>d</i><sub>2</sub> be the 2<sup>nd</sup> digit, and so on. In this way, we note the following:</p>
<ul>
<li><i>d</i><sub>2</sub><i>d</i><sub>3</sub><i>d</i><sub>4</sub>=406 is divisible by 2</li>
<li><i>d</i><sub>3</sub><i>d</i><sub>4</sub><i>d</i><sub>5</sub>=063 is divisible by 3</li>
<li><i>d</i><sub>4</sub><i>d</i><sub>5</sub><i>d</i><sub>6</sub>=635 is divisible by 5</li>
<li><i>d</i><sub>5</sub><i>d</i><sub>6</sub><i>d</i><sub>7</sub>=357 is divisible by 7</li>
<li><i>d</i><sub>6</sub><i>d</i><sub>7</sub><i>d</i><sub>8</sub>=572 is divisible by 11</li>
<li><i>d</i><sub>7</sub><i>d</i><sub>8</sub><i>d</i><sub>9</sub>=728 is divisible by 13</li>
<li><i>d</i><sub>8</sub><i>d</i><sub>9</sub><i>d</i><sub>10</sub>=289 is divisible by 17</li>
</ul>
<p>Find the sum of all 0 to 9 pandigital numbers with this property.</p>
</div><h3><a href="https://projecteuler.net/problem=44">Problem 44: Pentagon numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Pentagonal numbers are generated by the formula, P<sub><var>n</var></sub>=<var>n</var>(3<var>n</var><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)/2. The first ten pentagonal numbers are:</p>
<p style="text-align:center;">1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...</p>
<p>It can be seen that P<sub>4</sub> + P<sub>7</sub> = 22 + 70 = 92 = P<sub>8</sub>. However, their difference, 70 <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;"> 22 = 48, is not pentagonal.</p>
<p>Find the pair of pentagonal numbers, P<sub><var>j</var></sub> and P<sub><var>k</var></sub>, for which their sum and difference are pentagonal and D = |P<sub><var>k</var></sub> <img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;"> P<sub><var>j</var></sub>| is minimised; what is the value of D?</p>
</div><h3><a href="https://projecteuler.net/problem=45">Problem 45: Triangular, pentagonal, and hexagonal</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:</p>
<table>
<tbody><tr>
<td>Triangle</td>
<td> </td>
<td>T<sub><i>n</i></sub>=<i>n</i>(<i>n</i>+1)/2</td>
<td> </td>
<td>1, 3, 6, 10, 15, ...</td>
</tr>
<tr>
<td>Pentagonal</td>
<td> </td>
<td>P<sub><i>n</i></sub>=<i>n</i>(3<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)/2</td>
<td> </td>
<td>1, 5, 12, 22, 35, ...</td>
</tr>
<tr>
<td>Hexagonal</td>
<td> </td>
<td>H<sub><i>n</i></sub>=<i>n</i>(2<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)</td>
<td> </td>
<td>1, 6, 15, 28, 45, ...</td>
</tr>
</tbody></table>
<p>It can be verified that T<sub>285</sub> = P<sub>165</sub> = H<sub>143</sub> = 40755.</p>
<p>Find the next triangle number that is also pentagonal and hexagonal.</p>
</div><h3><a href="https://projecteuler.net/problem=46">Problem 46: Goldbach's other conjecture</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.</p>
<p style="margin-left:10px;">9 = 7 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">1<sup>2</sup><br>
15 = 7 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">2<sup>2</sup><br>
21 = 3 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">3<sup>2</sup><br>
25 = 7 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">3<sup>2</sup><br>
27 = 19 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">2<sup>2</sup><br>
33 = 31 + 2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">1<sup>2</sup></p>
<p>It turns out that the conjecture was false.</p>
<p>What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?</p>
</div><h3><a href="https://projecteuler.net/problem=47">Problem 47: Distinct primes factors</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The first two consecutive numbers to have two distinct prime factors are:</p>
<p style="margin-left:100px;">14 = 2 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 7<br>15 = 3 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 5</p>
<p>The first three consecutive numbers to have three distinct prime factors are:</p>
<p style="margin-left:100px;">644 = 2² <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 7 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 23<br>645 = 3 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 5 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 43<br>646 = 2 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 17 <img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;"> 19.</p>
<p>Find the first four consecutive integers to have four distinct prime factors. What is the first of these numbers?</p>
</div><h3><a href="https://projecteuler.net/problem=48">Problem 48: Self powers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 10<sup>10</sup> = 10405071317.</p>
<p>Find the last ten digits of the series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 1000<sup>1000</sup>.</p>
</div><h3><a href="https://projecteuler.net/problem=49">Problem 49: Prime permutations</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.</p>
<p>There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.</p>
<p>What 12-digit number do you form by concatenating the three terms in this sequence?</p>
</div><h3><a href="https://projecteuler.net/problem=50">Problem 50: Consecutive prime sum</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The prime 41, can be written as the sum of six consecutive primes:</p>
<div style="text-align:center;">41 = 2 + 3 + 5 + 7 + 11 + 13</div>
<p>This is the longest sum of consecutive primes that adds to a prime below one-hundred.</p>
<p>The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.</p>
<p>Which prime, below one-million, can be written as the sum of the most consecutive primes?</p>
</div><h3><a href="https://projecteuler.net/problem=51">Problem 51: Prime digit replacements</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><!--<p>By replacing the 1<sup>st</sup> digit of *57, it turns out that six of the possible values: 157, 257, 457, 557, 757, and 857, are all prime.</p> -->
<p>By replacing the 1<sup>st</sup> digit of the 2-digit number *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime.</p>
<p>By replacing the 3<sup>rd</sup> and 4<sup>th</sup> digits of 56**3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003, 56113, 56333, 56443, 56663, 56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property.</p>
<p>Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family.</p>
</div><h3><a href="https://projecteuler.net/problem=52">Problem 52: Permuted multiples</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.</p>
<p>Find the smallest positive integer, <i>x</i>, such that 2<i>x</i>, 3<i>x</i>, 4<i>x</i>, 5<i>x</i>, and 6<i>x</i>, contain the same digits.</p>
</div><h3><a href="https://projecteuler.net/problem=53">Problem 53: Combinatoric selections</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>There are exactly ten ways of selecting three from five, 12345:</p>
<p style="text-align:center;">123, 124, 125, 134, 135, 145, 234, 235, 245, and 345</p>
<p>In combinatorics, we use the notation, <sup>5</sup>C<sub>3</sub> = 10.</p>
<p>In general,</p>
<div style="text-align:center;">
<table>
<tbody><tr>
<td><sup><var>n</var></sup>C<sub><var>r</var></sub> = </td>
<td><div style="text-align:center;"><var>n</var>!<br><span style="border-top:1px solid #000;"><var>r</var>!(<var>n<img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">r</var>)!</span></div></td>
<td>,where <var>r</var> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <var>n</var>, <var>n</var>! = <var>n</var><img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">(<var>n</var><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">...<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">3<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">2<img src="./problems_files/symbol_times.gif" width="9" height="9" alt="×" border="0" style="vertical-align:middle;">1, and 0! = 1.</td>
</tr>
</tbody></table>
</div>
<p>It is not until <var>n</var> = 23, that a value exceeds one-million: <sup>23</sup>C<sub>10</sub> = 1144066.</p>
<p>How many, not necessarily distinct, values of <sup><var>n</var></sup>C<sub><var>r</var></sub>, for 1 <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> <var>n</var> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 100, are greater than one-million?</p>
</div><h3><a href="https://projecteuler.net/problem=54">Problem 54: Poker hands</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:</p>
<ul>
<li><b>High Card</b>: Highest value card.</li>
<li><b>One Pair</b>: Two cards of the same value.</li>
<li><b>Two Pairs</b>: Two different pairs.</li>
<li><b>Three of a Kind</b>: Three cards of the same value.</li>
<li><b>Straight</b>: All cards are consecutive values.</li>
<li><b>Flush</b>: All cards of the same suit.</li>
<li><b>Full House</b>: Three of a kind and a pair.</li>
<li><b>Four of a Kind</b>: Four cards of the same value.</li>
<li><b>Straight Flush</b>: All cards are consecutive values of same suit.</li>
<li><b>Royal Flush</b>: Ten, Jack, Queen, King, Ace, in same suit.</li>
</ul>
<p>The cards are valued in the order:<br>2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.</p>
<p>If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.</p>
<p>Consider the following five hands dealt to two players:</p>
<div style="text-align:center;">
<table>
<tbody><tr>
<td><b>Hand</b></td><td> </td><td><b>Player 1</b></td><td> </td><td><b>Player 2</b></td><td> </td><td><b>Winner</b></td>
</tr>
<tr>
<td style="vertical-align:top;"><b>1</b></td><td> </td><td>5H 5C 6S 7S KD<br><div class="info">Pair of Fives</div></td><td> </td><td>2C 3S 8S 8D TD<br><div class="info">Pair of Eights</div></td><td> </td><td style="vertical-align:top;">Player 2</td>
</tr>
<tr>
<td style="vertical-align:top;"><b>2</b></td><td> </td><td>5D 8C 9S JS AC<br><div class="info">Highest card Ace</div></td><td> </td><td>2C 5C 7D 8S QH<br><div class="info">Highest card Queen</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
</tr>
<tr>
<td style="vertical-align:top;"><b>3</b></td><td> </td><td>2D 9C AS AH AC<br><div class="info">Three Aces</div></td><td> </td><td>3D 6D 7D TD QD<br><div class="info">Flush with Diamonds</div></td><td> </td><td style="vertical-align:top;">Player 2</td>
</tr>
<tr>
<td style="vertical-align:top;"><b>4</b></td><td> </td><td>4D 6S 9H QH QC<br><div class="info">Pair of Queens<br>Highest card Nine</div></td><td> </td><td>3D 6D 7H QD QS<br><div class="info">Pair of Queens<br>Highest card Seven</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
</tr>
<tr>
<td style="vertical-align:top;"><b>5</b></td><td> </td><td>2H 2D 4C 4D 4S<br><div class="info">Full House<br>With Three Fours</div></td><td> </td><td>3C 3D 3S 9S 9D<br><div class="info">Full House<br>with Three Threes</div></td><td> </td><td style="vertical-align:top;">Player 1</td>
</tr>
</tbody></table>
</div>
<p>The file, <a href="https://projecteuler.net/project/poker.txt">poker.txt</a>, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.</p>
<p>How many hands does Player 1 win?</p>
</div><h3><a href="https://projecteuler.net/problem=55">Problem 55: Lychrel numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.</p>
<p>Not all numbers produce palindromes so quickly. For example,</p>
<p style="margin-left:50px;">349 + 943 = 1292,<br>
1292 + 2921 = 4213<br>
4213 + 3124 = 7337</p>
<p>That is, 349 took three iterations to arrive at a palindrome.</p>
<p>Although no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).</p>
<p>Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.</p>
<p>How many Lychrel numbers are there below ten-thousand?</p>
<p class="info">NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.</p>
</div><h3><a href="https://projecteuler.net/problem=56">Problem 56: Powerful digit sum</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>A googol (10<sup>100</sup>) is a massive number: one followed by one-hundred zeros; 100<sup>100</sup> is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.</p>
<p>Considering natural numbers of the form, <i>a<sup>b</sup></i>, where <i>a, b</i> <img src="./problems_files/symbol_lt.gif" width="10" height="10" alt="<" border="0" style="vertical-align:middle;"> 100, what is the maximum digital sum?</p>
</div><h3><a href="https://projecteuler.net/problem=57">Problem 57: Square root convergents</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>It is possible to show that the square root of two can be expressed as an infinite continued fraction.</p>
<p style="text-align:center;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;"> 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...</p>
<p>By expanding this for the first four iterations, we get:</p>
<p>1 + 1/2 = 3/2 = 1.5<br>
1 + 1/(2 + 1/2) = 7/5 = 1.4<br>
1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666...<br>
1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379...<br></p>
<p>The next three expansions are 99/70, 239/169, and 577/408, but the eighth expansion, 1393/985, is the first example where the number of digits in the numerator exceeds the number of digits in the denominator.</p>
<p>In the first one-thousand expansions, how many fractions contain a numerator with more digits than denominator?</p>
</div><h3><a href="https://projecteuler.net/problem=58">Problem 58: Spiral primes</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed.</p>
<p style="text-align:center;font-family:courier new;"><span style="color:#ff0000;font-family:courier new;"><b>37</b></span> 36 35 34 33 32 <span style="color:#ff0000;font-family:courier new;"><b>31</b></span><br>
38 <span style="color:#ff0000;font-family:courier new;"><b>17</b></span> 16 15 14 <span style="color:#ff0000;font-family:courier new;"><b>13</b></span> 30<br>
39 18 <span style="color:#ff0000;font-family:courier new;"> <b>5</b></span> 4 <span style="color:#ff0000;font-family:courier new;"> <b>3</b></span> 12 29<br>
40 19 6 1 2 11 28<br>
41 20 <span style="color:#ff0000;font-family:courier new;"> <b>7</b></span> 8 9 10 27<br>
42 21 22 23 24 25 26<br>
<span style="color:#ff0000;font-family:courier new;"><b>43</b></span> 44 45 46 47 48 49</p>
<p>It is interesting to note that the odd squares lie along the bottom right diagonal, but what is more interesting is that 8 out of the 13 numbers lying along both diagonals are prime; that is, a ratio of 8/13 <img src="./problems_files/symbol_asymp.gif" width="11" height="9" alt="≈" border="0" style="vertical-align:middle;"> 62%.</p>
<p>If one complete new layer is wrapped around the spiral above, a square spiral with side length 9 will be formed. If this process is continued, what is the side length of the square spiral for which the ratio of primes along both diagonals first falls below 10%?</p>
</div><h3><a href="https://projecteuler.net/problem=59">Problem 59: XOR decryption</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A = 65, asterisk (*) = 42, and lowercase k = 107.</p>
<p>A modern encryption method is to take a text file, convert the bytes to ASCII, then XOR each byte with a given value, taken from a secret key. The advantage with the XOR function is that using the same encryption key on the cipher text, restores the plain text; for example, 65 XOR 42 = 107, then 107 XOR 42 = 65.</p>
<p>For unbreakable encryption, the key is the same length as the plain text message, and the key is made up of random bytes. The user would keep the encrypted message and the encryption key in different locations, and without both "halves", it is impossible to decrypt the message.</p>
<p>Unfortunately, this method is impractical for most users, so the modified method is to use a password as a key. If the password is shorter than the message, which is likely, the key is repeated cyclically throughout the message. The balance for this method is using a sufficiently long password key for security, but short enough to be memorable.</p>
<p>Your task has been made easy, as the encryption key consists of three lower case characters. Using <a href="https://projecteuler.net/project/cipher1.txt">cipher1.txt</a> (right click and 'Save Link/Target As...'), a file containing the encrypted ASCII codes, and the knowledge that the plain text must contain common English words, decrypt the message and find the sum of the ASCII values in the original text.</p>
</div><h3><a href="https://projecteuler.net/problem=60">Problem 60: Prime pair sets</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowest sum for a set of four primes with this property.</p>
<p>Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.</p>
</div><h3><a href="https://projecteuler.net/problem=61">Problem 61: Cyclical figurate numbers</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:</p>
<table>
<tbody><tr>
<td>Triangle</td>
<td> </td>
<td>P<sub>3,<i>n</i></sub>=<i>n</i>(<i>n</i>+1)/2</td>
<td> </td>
<td>1, 3, 6, 10, 15, ...</td>
</tr>
<tr>
<td>Square</td>
<td> </td>
<td>P<sub>4,<i>n</i></sub>=<i>n</i><sup>2</sup></td>
<td> </td>
<td>1, 4, 9, 16, 25, ...</td>
</tr>
<tr>
<td>Pentagonal</td>
<td> </td>
<td>P<sub>5,<i>n</i></sub>=<i>n</i>(3<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)/2</td>
<td> </td>
<td>1, 5, 12, 22, 35, ...</td>
</tr>
<tr>
<td>Hexagonal</td>
<td> </td>
<td>P<sub>6,<i>n</i></sub>=<i>n</i>(2<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">1)</td>
<td> </td>
<td>1, 6, 15, 28, 45, ...</td>
</tr>
<tr>
<td>Heptagonal</td>
<td> </td>
<td>P<sub>7,<i>n</i></sub>=<i>n</i>(5<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">3)/2</td>
<td> </td>
<td>1, 7, 18, 34, 55, ...</td>
</tr>
<tr>
<td>Octagonal</td>
<td> </td>
<td>P<sub>8,<i>n</i></sub>=<i>n</i>(3<i>n</i><img src="./problems_files/symbol_minus.gif" width="9" height="3" alt="−" border="0" style="vertical-align:middle;">2)</td>
<td> </td>
<td>1, 8, 21, 40, 65, ...</td>
</tr>
</tbody></table>
<p>The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.</p>
<ol>
<li>The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).</li>
<li>Each polygonal type: triangle (P<sub>3,127</sub>=8128), square (P<sub>4,91</sub>=8281), and pentagonal (P<sub>5,44</sub>=2882), is represented by a different number in the set.</li>
<li>This is the only set of 4-digit numbers with this property.</li>
</ol>
<p>Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.</p>
</div><h3><a href="https://projecteuler.net/problem=62">Problem 62: Cubic permutations</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The cube, 41063625 (345<sup>3</sup>), can be permuted to produce two other cubes: 56623104 (384<sup>3</sup>) and 66430125 (405<sup>3</sup>). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.</p>
<p>Find the smallest cube for which exactly five permutations of its digits are cube.</p>
</div><h3><a href="https://projecteuler.net/problem=63">Problem 63: Powerful digit counts</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content">
<p>The 5-digit number, 16807=7<sup>5</sup>, is also a fifth power. Similarly, the 9-digit number, 134217728=8<sup>9</sup>, is a ninth power.</p>
<p>How many <i>n</i>-digit positive integers exist which are also an <i>n</i>th power?</p>
</div><h3><a href="https://projecteuler.net/problem=64">Problem 64: Odd period square roots</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>All square roots are periodic when written as continued fractions and can be written in the form:</p>
<div style="margin-left:20px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;"><var>N</var> = <var>a</var><sub>0</sub> +</td>
<td colspan="3" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td><var>a</var><sub>1</sub> +</td>
<td colspan="2" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><var>a</var><sub>2</sub> +</td>
<td style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><var>a</var><sub>3</sub> + ...</td>
</tr>
</tbody></table>
</div>
<p>For example, let us consider <img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23:</p>
<div style="margin-left:20px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23 = 4 + <img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23 — 4 = 4 + </td>
<td style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
<td> = 4 + </td>
<td colspan="2" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td><div style="text-align:center;">1<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span></div></td>
<td> </td>
<td>1 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23 – 3</span><br>7</div></td>
</tr>
</tbody></table>
</div>
<p>If we continue we would get the following expansion:</p>
<div style="margin-left:20px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23 = 4 +</td>
<td colspan="4" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td>1 +</td>
<td colspan="3" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>3 +</td>
<td colspan="2" style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>1 +</td>
<td style="border-bottom:1px solid #000;"><div style="text-align:center;">1</div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>8 + ...</td>
</tr>
</tbody></table>
</div>
<p>The process can be summarised as follows:</p>
<div style="margin-left:20px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td><var>a</var><sub>0</sub> = 4,</td>
<td> </td>
<td><div style="text-align:center;">1<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+4</span><br>7</div></td>
<td> = 1 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span><br>7</div></td>
</tr>
<tr>
<td><var>a</var><sub>1</sub> = 1,</td>
<td> </td>
<td><div style="text-align:center;">7<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">7(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+3)</span><br>14</div></td>
<td> = 3 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span><br>2</div></td>
</tr>
<tr>
<td><var>a</var><sub>2</sub> = 3,</td>
<td> </td>
<td><div style="text-align:center;">2<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">2(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+3)</span><br>14</div></td>
<td> = 1 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span><br>7</div></td>
</tr>
<tr>
<td><var>a</var><sub>3</sub> = 1,</td>
<td> </td>
<td><div style="text-align:center;">7<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">7(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+4)</span><br>7</div></td>
<td> = 8 + </td>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</td>
</tr>
<tr>
<td><var>a</var><sub>4</sub> = 8,</td>
<td> </td>
<td><div style="text-align:center;">1<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+4</span><br>7</div></td>
<td> = 1 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span><br>7</div></td>
</tr>
<tr>
<td><var>a</var><sub>5</sub> = 1,</td>
<td> </td>
<td><div style="text-align:center;">7<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">7(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+3)</span><br>14</div></td>
<td> = 3 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span><br>2</div></td>
</tr>
<tr>
<td><var>a</var><sub>6</sub> = 3,</td>
<td> </td>
<td><div style="text-align:center;">2<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—3</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">2(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+3)</span><br>14</div></td>
<td> = 1 + </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span><br>7</div></td>
</tr>
<tr>
<td><var>a</var><sub>7</sub> = 1,</td>
<td> </td>
<td><div style="text-align:center;">7<br><span style="border-top:1px solid #000;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</span></div></td>
<td> = </td>
<td><div style="text-align:center;"><span style="border-bottom:1px solid #000;">7(<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23+4)</span><br>7</div></td>
<td> = 8 + </td>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23—4</td>
</tr>
</tbody></table>
</div>
<p>It can be seen that the sequence is repeating. For conciseness, we use the notation <img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">23 = [4;(1,3,1,8)], to indicate that the block (1,3,1,8) repeats indefinitely.</p>
<p>The first ten continued fraction representations of (irrational) square roots are:</p>
<p style="margin-left:20px;"><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">2=[1;(2)], period=1<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">3=[1;(1,2)], period=2<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">5=[2;(4)], period=1<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">6=[2;(2,4)], period=2<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">7=[2;(1,1,1,4)], period=4<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">8=[2;(1,4)], period=2<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">10=[3;(6)], period=1<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">11=[3;(3,6)], period=2<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">12= [3;(2,6)], period=2<br>
<img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">13=[3;(1,1,1,1,6)], period=5</p>
<p>Exactly four continued fractions, for <var>N</var> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 13, have an odd period.</p>
<p>How many continued fractions for <var>N</var> <img src="./problems_files/symbol_le.gif" width="10" height="12" alt="≤" border="0" style="vertical-align:middle;"> 10000 have an odd period?</p>
</div><h3><a href="https://projecteuler.net/problem=65">Problem 65: Convergents of e</a></h3><div style="border-bottom:1px solid #999;padding-bottom:20px;margin-bottom:20px;" class="problem_content"><p>The square root of 2 can be written as an infinite continued fraction.</p>
<div style="margin-left:20px;">
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td><img src="./problems_files/symbol_radic.gif" width="14" height="16" alt="√" border="0" style="vertical-align:middle;">2 = 1 +</td>
<td colspan="4"><div style="text-align:center;">1<br><img src="./problems_files/blackdot.gif" width="135" height="1" alt=""><br></div></td>
</tr>
<tr>
<td> </td>
<td>2 +</td>
<td colspan="3"><div style="text-align:center;">1<br><img src="./problems_files/blackdot.gif" width="110" height="1" alt=""><br></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>2 +</td>
<td colspan="2"><div style="text-align:center;">1<br><img src="./problems_files/blackdot.gif" width="85" height="1" alt=""><br></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>2 +</td>
<td><div style="text-align:center;">1<br><img src="./problems_files/blackdot.gif" width="60" height="1" alt=""><br></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>2 + ...</td>
</tr>
</tbody></table>