fix: improve Project Euler descriptions, challenge seeds, and test cases (#38016)
* fix: improve Project Euler descriptions and test case Improve formatting of Project Euler test descriptions. Also add poker hands array and new test case for problem 54 * feat: add typeof tests and gave functions proper names for first 100 challenges * fix: continue fixing test descriptions and adding "before test" sections * fix: address review comments * fix: adjust grids in 18 and 67 and fix some text that reference files rather than the given arrays * fix: implement bug fixes and improvements from review * fix: remove console.log statements from seed and solution
This commit is contained in:
committed by
GitHub
parent
41718abf76
commit
6cfd0fc503
@ -7,8 +7,11 @@ forumTopicId: 301722
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
Find the sum of all the multiples of 3 or 5 below the provided parameter value <code>number</code>.
|
||||
|
||||
Find the sum of all the multiples of 3 or 5 below the provided parameter value `number`.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,14 +24,16 @@ Find the sum of all the multiples of 3 or 5 below the provided parameter value <
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>multiplesOf3and5(1000)</code> should return 233168.
|
||||
testString: assert.strictEqual(multiplesOf3and5(1000), 233168);
|
||||
- text: <code>multiplesOf3and5(10)</code> should return a number.
|
||||
testString: assert(typeof multiplesOf3and5(10) === 'number');
|
||||
- text: <code>multiplesOf3and5(49)</code> should return 543.
|
||||
testString: assert.strictEqual(multiplesOf3and5(49), 543);
|
||||
- text: <code>multiplesOf3and5(19564)</code> should return 89301183.
|
||||
testString: assert.strictEqual(multiplesOf3and5(19564), 89301183);
|
||||
- text: <code>multiplesOf3and5(1000)</code> should return 233168.
|
||||
testString: assert.strictEqual(multiplesOf3and5(1000), 233168);
|
||||
- text: <code>multiplesOf3and5(8456)</code> should return 16687353.
|
||||
testString: assert.strictEqual(multiplesOf3and5(8456), 16687353);
|
||||
- text: <code>multiplesOf3and5(19564)</code> should return 89301183.
|
||||
testString: assert.strictEqual(multiplesOf3and5(19564), 89301183);
|
||||
|
||||
```
|
||||
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 301723
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
|
||||
Find the sum of all the primes below n.
|
||||
|
||||
Find the sum of all the primes below `n`.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ Find the sum of all the primes below n.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>primeSummation(17)</code> should return a number.
|
||||
testString: assert(typeof primeSummation(17) === 'number');
|
||||
- text: <code>primeSummation(17)</code> should return 41.
|
||||
testString: assert.strictEqual(primeSummation(17), 41);
|
||||
- text: <code>primeSummation(2001)</code> should return 277050.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301724
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)×(14/20) = 1/2.
|
||||
|
||||
The next such arrangement, for which there is exactly 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
|
||||
By finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain.
|
||||
|
||||
By finding the first arrangement to contain over 10<sup>12</sup> = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ By finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler100()</code> should return 756872327473.
|
||||
testString: assert.strictEqual(euler100(), 756872327473);
|
||||
- text: <code>arrangedProbability()</code> should return a number.
|
||||
testString: assert(typeof arrangedProbability() === 'number');
|
||||
- text: <code>arrangedProbability()</code> should return 756872327473.
|
||||
testString: assert.strictEqual(arrangedProbability(), 756872327473);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler100() {
|
||||
function arrangedProbability() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler100();
|
||||
arrangedProbability();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,31 +7,36 @@ forumTopicId: 301734
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
|
||||
|
||||
<div style='text-align: center;'>08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08</div>
|
||||
<div style='text-align: center;'>49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00</div>
|
||||
<div style='text-align: center;'>81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65</div>
|
||||
<div style='text-align: center;'>52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91</div>
|
||||
<div style='text-align: center;'>22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80</div>
|
||||
<div style='text-align: center;'>24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50</div>
|
||||
<div style='text-align: center;'>32 98 81 28 64 23 67 10 <span style='color: red'><b>26</b></span> 38 40 67 59 54 70 66 18 38 64 70</div>
|
||||
<div style='text-align: center;'>67 26 20 68 02 62 12 20 95 <span style='color: red'><b>63</b></span> 94 39 63 08 40 91 66 49 94 21</div>
|
||||
<div style='text-align: center;'>24 55 58 05 66 73 99 26 97 17 <span style='color: red'><b>78</b></span> 78 96 83 14 88 34 89 63 72</div>
|
||||
<div style='text-align: center;'>21 36 23 09 75 00 76 44 20 45 35 <span style='color: red'><b>14</b></span> 00 61 33 97 34 31 33 95</div>
|
||||
<div style='text-align: center;'>78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92</div>
|
||||
<div style='text-align: center;'>16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57</div>
|
||||
<div style='text-align: center;'>86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58</div>
|
||||
<div style='text-align: center;'>19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40</div>
|
||||
<div style='text-align: center;'>04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66</div>
|
||||
<div style='text-align: center;'>88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69</div>
|
||||
<div style='text-align: center;'>04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36</div>
|
||||
<div style='text-align: center;'>20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16</div>
|
||||
<div style='text-align: center;'>20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54</div>
|
||||
<div style='text-align: center;'>01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48</div>
|
||||
<div style='text-align: center;'>
|
||||
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: red'><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: red'><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: red'><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: red'><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>
|
||||
</div>
|
||||
|
||||
The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
|
||||
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in a given <code>arr</code> grid?
|
||||
|
||||
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in a given `arr` grid?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -44,10 +49,12 @@ What is the greatest product of four adjacent numbers in the same direction (up,
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largestGridProduct(grid)</code> should return 70600674.
|
||||
testString: assert.strictEqual(largestGridProduct(grid), 70600674);
|
||||
- text: <code>largestGridProduct(testGrid)</code> should return a number.
|
||||
testString: assert(typeof largestGridProduct(testGrid) === 'number');
|
||||
- text: <code>largestGridProduct(testGrid)</code> should return 14169081.
|
||||
testString: assert.strictEqual(largestGridProduct(testGrid), 14169081);
|
||||
- text: <code>largestGridProduct(grid)</code> should return 70600674.
|
||||
testString: assert.strictEqual(largestGridProduct(grid), 70600674);
|
||||
|
||||
```
|
||||
|
||||
@ -61,7 +68,7 @@ tests:
|
||||
```js
|
||||
function largestGridProduct(arr) {
|
||||
// Good luck!
|
||||
return arr;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only change code above this line
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301746
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
|
||||
|
||||
<div style='text-align: center;'>1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...</div>
|
||||
|
||||
Let us list the factors of the first seven triangle numbers:
|
||||
|
||||
<div style='padding-left: 4em;'><b>1:</b> 1</div>
|
||||
<div style='padding-left: 4em;'><b>3:</b> 1, 3</div>
|
||||
<div style='padding-left: 4em;'><b>6:</b> 1, 2, 3, 6</div>
|
||||
@ -17,8 +21,11 @@ Let us list the factors of the first seven triangle numbers:
|
||||
<div style='padding-left: 4em;'><b>15:</b> 1, 3, 5, 15</div>
|
||||
<div style='padding-left: 4em;'><b>21:</b> 1, 3, 7, 21</div>
|
||||
<div style='padding-left: 4em;'><b>28:</b> 1, 2, 4, 7, 14, 28</div>
|
||||
|
||||
We can see that 28 is the first triangle number to have over five divisors.
|
||||
What is the value of the first triangle number to have over <code>n</code> divisors?
|
||||
|
||||
What is the value of the first triangle number to have over `n` divisors?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -31,6 +38,8 @@ What is the value of the first triangle number to have over <code>n</code> divis
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>divisibleTriangleNumber(5)</code> should return a number.
|
||||
testString: assert(typeof divisibleTriangleNumber(5) === 'number');
|
||||
- text: <code>divisibleTriangleNumber(5)</code> should return 28.
|
||||
testString: assert.strictEqual(divisibleTriangleNumber(5), 28);
|
||||
- text: <code>divisibleTriangleNumber(23)</code> should return 630.
|
||||
|
@ -7,108 +7,112 @@ forumTopicId: 301757
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
|
||||
|
||||
37107287533902102798797998220837590246510135740250
|
||||
46376937677490009712648124896970078050417018260538
|
||||
74324986199524741059474233309513058123726617309629
|
||||
91942213363574161572522430563301811072406154908250
|
||||
23067588207539346171171980310421047513778063246676
|
||||
89261670696623633820136378418383684178734361726757
|
||||
28112879812849979408065481931592621691275889832738
|
||||
44274228917432520321923589422876796487670272189318
|
||||
47451445736001306439091167216856844588711603153276
|
||||
70386486105843025439939619828917593665686757934951
|
||||
62176457141856560629502157223196586755079324193331
|
||||
64906352462741904929101432445813822663347944758178
|
||||
92575867718337217661963751590579239728245598838407
|
||||
58203565325359399008402633568948830189458628227828
|
||||
80181199384826282014278194139940567587151170094390
|
||||
35398664372827112653829987240784473053190104293586
|
||||
86515506006295864861532075273371959191420517255829
|
||||
71693888707715466499115593487603532921714970056938
|
||||
54370070576826684624621495650076471787294438377604
|
||||
53282654108756828443191190634694037855217779295145
|
||||
36123272525000296071075082563815656710885258350721
|
||||
45876576172410976447339110607218265236877223636045
|
||||
17423706905851860660448207621209813287860733969412
|
||||
81142660418086830619328460811191061556940512689692
|
||||
51934325451728388641918047049293215058642563049483
|
||||
62467221648435076201727918039944693004732956340691
|
||||
15732444386908125794514089057706229429197107928209
|
||||
55037687525678773091862540744969844508330393682126
|
||||
18336384825330154686196124348767681297534375946515
|
||||
80386287592878490201521685554828717201219257766954
|
||||
78182833757993103614740356856449095527097864797581
|
||||
16726320100436897842553539920931837441497806860984
|
||||
48403098129077791799088218795327364475675590848030
|
||||
87086987551392711854517078544161852424320693150332
|
||||
59959406895756536782107074926966537676326235447210
|
||||
69793950679652694742597709739166693763042633987085
|
||||
41052684708299085211399427365734116182760315001271
|
||||
65378607361501080857009149939512557028198746004375
|
||||
35829035317434717326932123578154982629742552737307
|
||||
94953759765105305946966067683156574377167401875275
|
||||
88902802571733229619176668713819931811048770190271
|
||||
25267680276078003013678680992525463401061632866526
|
||||
36270218540497705585629946580636237993140746255962
|
||||
24074486908231174977792365466257246923322810917141
|
||||
91430288197103288597806669760892938638285025333403
|
||||
34413065578016127815921815005561868836468420090470
|
||||
23053081172816430487623791969842487255036638784583
|
||||
11487696932154902810424020138335124462181441773470
|
||||
63783299490636259666498587618221225225512486764533
|
||||
67720186971698544312419572409913959008952310058822
|
||||
95548255300263520781532296796249481641953868218774
|
||||
76085327132285723110424803456124867697064507995236
|
||||
37774242535411291684276865538926205024910326572967
|
||||
23701913275725675285653248258265463092207058596522
|
||||
29798860272258331913126375147341994889534765745501
|
||||
18495701454879288984856827726077713721403798879715
|
||||
38298203783031473527721580348144513491373226651381
|
||||
34829543829199918180278916522431027392251122869539
|
||||
40957953066405232632538044100059654939159879593635
|
||||
29746152185502371307642255121183693803580388584903
|
||||
41698116222072977186158236678424689157993532961922
|
||||
62467957194401269043877107275048102390895523597457
|
||||
23189706772547915061505504953922979530901129967519
|
||||
86188088225875314529584099251203829009407770775672
|
||||
11306739708304724483816533873502340845647058077308
|
||||
82959174767140363198008187129011875491310547126581
|
||||
97623331044818386269515456334926366572897563400500
|
||||
42846280183517070527831839425882145521227251250327
|
||||
55121603546981200581762165212827652751691296897789
|
||||
32238195734329339946437501907836945765883352399886
|
||||
75506164965184775180738168837861091527357929701337
|
||||
62177842752192623401942399639168044983993173312731
|
||||
32924185707147349566916674687634660915035914677504
|
||||
99518671430235219628894890102423325116913619626622
|
||||
73267460800591547471830798392868535206946944540724
|
||||
76841822524674417161514036427982273348055556214818
|
||||
97142617910342598647204516893989422179826088076852
|
||||
87783646182799346313767754307809363333018982642090
|
||||
10848802521674670883215120185883543223812876952786
|
||||
71329612474782464538636993009049310363619763878039
|
||||
62184073572399794223406235393808339651327408011116
|
||||
66627891981488087797941876876144230030984490851411
|
||||
60661826293682836764744779239180335110989069790714
|
||||
85786944089552990653640447425576083659976645795096
|
||||
66024396409905389607120198219976047599490197230297
|
||||
64913982680032973156037120041377903785566085089252
|
||||
16730939319872750275468906903707539413042652315011
|
||||
94809377245048795150954100921645863754710598436791
|
||||
78639167021187492431995700641917969777599028300699
|
||||
15368713711936614952811305876380278410754449733078
|
||||
40789923115535562561142322423255033685442488917353
|
||||
44889911501440648020369068063960672322193204149535
|
||||
41503128880339536053299340368006977710650566631954
|
||||
81234880673210146739058568557934581403627822703280
|
||||
82616570773948327592232845941706525094512325230608
|
||||
22918802058777319719839450180888072429661980811197
|
||||
77158542502016545090413245809786882778948721859617
|
||||
72107838435069186155435662884062257473692284509516
|
||||
20849603980134001723930671666823555245252804609722
|
||||
53503534226472524250874054075591789781264330331690
|
||||
<div style='padding-left: 4em;'>
|
||||
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>
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -121,6 +125,8 @@ Work out the first ten digits of the sum of the following one-hundred 50-digit n
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largeSum(testNums)</code> should return a number.
|
||||
testString: assert(typeof largeSum(testNums) === 'number');
|
||||
- text: <code>largeSum(testNums)</code> should return 8348422521.
|
||||
testString: assert.strictEqual(largeSum(testNums), 8348422521);
|
||||
- text: <code>largeSum(fiftyDigitNums)</code> should return 5537376230.
|
||||
@ -141,7 +147,7 @@ function largeSum(arr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// only change code above this line
|
||||
// Only change code above this line
|
||||
|
||||
const testNums = [
|
||||
'37107287533902102798797998220837590246510135740250',
|
||||
|
@ -7,14 +7,23 @@ forumTopicId: 301768
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The following iterative sequence is defined for the set of positive integers:
|
||||
|
||||
<div style='padding-left: 4em;'><var>n</var> → <var>n</var>/2 (<var>n</var> is even)</div>
|
||||
|
||||
<div style='padding-left: 4em;'><var>n</var> → 3<var>n</var> + 1 (<var>n</var> is odd)</div>
|
||||
|
||||
Using the rule above and starting with 13, we generate the following sequence:
|
||||
|
||||
<div style='text-align: center;'>13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1</div>
|
||||
|
||||
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.
|
||||
Which starting number, under the given <code>limit</code>, produces the longest chain?
|
||||
NOTE: Once the chain starts the terms are allowed to go above one million.
|
||||
|
||||
Which starting number, under the given `limit`, produces the longest chain?
|
||||
|
||||
**Note:** Once the chain starts the terms are allowed to go above one million.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -27,6 +36,8 @@ NOTE: Once the chain starts the terms are allowed to go above one million.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>longestCollatzSequence(14)</code> should return a number.
|
||||
testString: assert(typeof longestCollatzSequence(14) === 'number');
|
||||
- text: <code>longestCollatzSequence(14)</code> should return 9.
|
||||
testString: assert.strictEqual(longestCollatzSequence(14), 9);
|
||||
- text: <code>longestCollatzSequence(5847)</code> should return 3711.
|
||||
|
@ -7,11 +7,13 @@ forumTopicId: 301780
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner" src="https://cdn-media-1.freecodecamp.org/imgr/1Atixoj.gif">
|
||||
<img class="img-responsive center-block" alt="a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner" src="https://cdn-media-1.freecodecamp.org/project-euler/1Atixoj.gif" style="background-color: white; padding: 10px;">
|
||||
|
||||
How many such routes are there through a given `gridSize`?
|
||||
|
||||
How many such routes are there through a given <code>gridSize</code>?
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,6 +26,8 @@ How many such routes are there through a given <code>gridSize</code>?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>latticePaths(4)</code> should return a number.
|
||||
testString: assert(typeof latticePaths(4) === 'number');
|
||||
- text: <code>latticePaths(4)</code> should return 70.
|
||||
testString: assert.strictEqual(latticePaths(4), 70);
|
||||
- text: <code>latticePaths(9)</code> should return 48620.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 301791
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
2<sup>15</sup> = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
|
||||
What is the sum of the digits of the number 2<sup><code>exponent</code></sup>?
|
||||
|
||||
What is the sum of the digits of the number 2<sup>`exponent`</sup>?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ What is the sum of the digits of the number 2<sup><code>exponent</code></sup>?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>powerDigitSum(15)</code> should return a number.
|
||||
testString: assert(typeof powerDigitSum(15) === 'number');
|
||||
- text: <code>powerDigitSum(15)</code> should return 26.
|
||||
testString: assert.strictEqual(powerDigitSum(15), 26);
|
||||
- text: <code>powerDigitSum(128)</code> should return 166.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301804
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
If all the numbers from 1 to given <code>limit</code> inclusive were written out in words, how many letters would be used?
|
||||
<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.
|
||||
|
||||
If all the numbers from 1 to given `limit` inclusive were written out in words, how many letters would be used?
|
||||
|
||||
**Note:** 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.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ If all the numbers from 1 to given <code>limit</code> inclusive were written out
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>numberLetterCounts(5)</code> should return a number.
|
||||
testString: assert(typeof numberLetterCounts(5) === 'number');
|
||||
- text: <code>numberLetterCounts(5)</code> should return 19.
|
||||
testString: assert.strictEqual(numberLetterCounts(5), 19);
|
||||
- text: <code>numberLetterCounts(150)</code> should return 1903.
|
||||
@ -120,7 +126,6 @@ function numberLetterCounts(limit) {
|
||||
tempStr += dictionary[tens] + dictionary[remainder];
|
||||
}
|
||||
}
|
||||
// console.log(num, hundreds, tens, remainder);
|
||||
return tempStr;
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,24 @@ forumTopicId: 301815
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
<span style='display: block; text-align: center;'><b style='color: red;'>3</b><br><b style='color: red;'>7</b> 4<br>2 <b style='color: red;'>4</b> 6<br>8 5 <b style='color: red;'>9</b> 3</span>
|
||||
|
||||
<span style='display: block; text-align: center;'>
|
||||
<strong style='color: red;'>3</strong><br>
|
||||
<strong style='color: red;'>7</strong> 4<br>
|
||||
2 <strong style='color: red;'>4</strong> 6<br>
|
||||
8 5 <strong style='color: red;'>9</strong> 3
|
||||
</span>
|
||||
|
||||
That is, 3 + 7 + 4 + 9 = 23.
|
||||
|
||||
Find the maximum total from top to bottom of the triangle below:
|
||||
|
||||
<span style='display: block; text-align: center;'>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</span>
|
||||
<b>NOTE:</b> As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)
|
||||
|
||||
**NOTE:** As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,6 +37,8 @@ Find the maximum total from top to bottom of the triangle below:
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>maximumPathSumI(testTriangle)</code> should return a number.
|
||||
testString: assert(typeof maximumPathSumI(testTriangle) === 'number');
|
||||
- text: <code>maximumPathSumI(testTriangle)</code> should return 23.
|
||||
testString: assert.strictEqual(maximumPathSumI(testTriangle), 23);
|
||||
- text: <code>maximumPathSumI(numTriangle)</code> should return 1074.
|
||||
|
@ -7,9 +7,17 @@ forumTopicId: 301827
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
You are given the following information, but you may prefer to do some research for yourself.
|
||||
<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>
|
||||
<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>
|
||||
|
||||
How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +30,8 @@ How many Sundays fell on the first of the month during the twentieth century (1
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>countingSundays(1943, 1946)</code> should return a number.
|
||||
testString: assert(typeof countingSundays(1943, 1946) === 'number');
|
||||
- text: <code>countingSundays(1943, 1946)</code> should return 6.
|
||||
testString: assert.strictEqual(countingSundays(1943, 1946), 6);
|
||||
- text: <code>countingSundays(1995, 2000)</code> should return 10.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 301838
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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:
|
||||
|
||||
<div style='text-align: center;'>1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...</div>
|
||||
|
||||
By considering the terms in the Fibonacci sequence whose values do not exceed <code>n</code>, find the sum of the even-valued terms.
|
||||
</section>
|
||||
|
||||
@ -22,6 +25,8 @@ By considering the terms in the Fibonacci sequence whose values do not exceed <c
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>fiboEvenSum(10)</code> should return a number.
|
||||
testString: assert(typeof fiboEvenSum(10) === 'number');
|
||||
- text: <code>fiboEvenSum(10)</code> should return 10.
|
||||
testString: assert.strictEqual(fiboEvenSum(10), 10);
|
||||
- text: <code>fiboEvenSum(60)</code> should return 44.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301839
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
<var>n</var>! means <var>n</var> × (<var>n</var> − 1) × ... × 3 × 2 × 1
|
||||
|
||||
For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,<br>and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
|
||||
Find the sum of the digits <var>n</var>!
|
||||
|
||||
Find the sum of the digits `n`!
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ Find the sum of the digits <var>n</var>!
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>sumFactorialDigits(10)</code> should return a number.
|
||||
testString: assert(typeof sumFactorialDigits(10) === 'number');
|
||||
- text: <code>sumFactorialDigits(10)</code> should return 27.
|
||||
testString: assert.strictEqual(sumFactorialDigits(10), 27);
|
||||
- text: <code>sumFactorialDigits(25)</code> should return 72.
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 301851
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Let d(<var>n</var>) be defined as the sum of proper divisors of <var>n</var> (numbers less than <var>n</var> which divide evenly into <var>n</var>).
|
||||
|
||||
If d(<var>a</var>) = <var>b</var> and d(<var>b</var>) = <var>a</var>, where <var>a</var> ≠ <var>b</var>, then <var>a</var> and <var>b</var> are an amicable pair and each of <var>a</var> and <var>b</var> are called amicable numbers.
|
||||
|
||||
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.
|
||||
Evaluate the sum of all the amicable numbers under <var>n</var>.
|
||||
|
||||
Evaluate the sum of all the amicable numbers under `n`.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ Evaluate the sum of all the amicable numbers under <var>n</var>.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>sumAmicableNum(1000)</code> should return a number.
|
||||
testString: assert(typeof sumAmicableNum(1000) === 'number');
|
||||
- text: <code>sumAmicableNum(1000)</code> should return 504.
|
||||
testString: assert.strictEqual(sumAmicableNum(1000), 504);
|
||||
- text: <code>sumAmicableNum(2000)</code> should return 2898.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301862
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Using <code>names</code>, an array 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.
|
||||
|
||||
Using `names`, an array defined in the background 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.
|
||||
|
||||
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 × 53 = 49714.
|
||||
What is the total of all the name scores in the file?
|
||||
|
||||
What is the total of all the name scores in the array?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ What is the total of all the name scores in the file?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>namesScores(test1)</code> should return a number.
|
||||
testString: assert(typeof namesScores(test1) === 'number');
|
||||
- text: <code>namesScores(test1)</code> should return 791.
|
||||
testString: assert.strictEqual(namesScores(test1), 791);
|
||||
- text: <code>namesScores(test2)</code> should return 1468.
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 301873
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
|
||||
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>.
|
||||
|
||||
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.
|
||||
Find the sum of all positive integers <= <var>n</var> which cannot be written as the sum of two abundant numbers.
|
||||
|
||||
Find the sum of all positive integers <= `n` which cannot be written as the sum of two abundant numbers.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ Find the sum of all positive integers <= <var>n</var> which cannot be written as
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>sumOfNonAbundantNumbers(10000)</code> should return a number.
|
||||
testString: assert(typeof sumOfNonAbundantNumbers(10000) === 'number');
|
||||
- text: <code>sumOfNonAbundantNumbers(10000)</code> should return 3731004.
|
||||
testString: assert(sumOfNonAbundantNumbers(10000) === 3731004);
|
||||
- text: <code>sumOfNonAbundantNumbers(15000)</code> should return 4039939.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301885
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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:
|
||||
|
||||
<div style='text-align: center;'>012 021 102 120 201 210</div>
|
||||
What is the <var>n</var>th lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
|
||||
|
||||
What is the `n`th lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ What is the <var>n</var>th lexicographic permutation of the digits 0, 1, 2, 3, 4
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>lexicographicPermutations(699999)</code> should return a number.
|
||||
testString: assert(typeof lexicographicPermutations(699999) === 'number');
|
||||
- text: <code>lexicographicPermutations(699999)</code> should return 1938246570.
|
||||
testString: assert(lexicographicPermutations(699999) == 1938246570);
|
||||
- text: <code>lexicographicPermutations(899999)</code> should return 2536987410.
|
||||
|
@ -7,12 +7,19 @@ forumTopicId: 301897
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The Fibonacci sequence is defined by the recurrence relation:
|
||||
|
||||
<div style='padding-left: 4em;'>F<sub>n</sub> = F<sub>n−1</sub> + F<sub>n−2</sub>, where F<sub>1</sub> = 1 and F<sub>2</sub> = 1.</div>
|
||||
|
||||
Hence the first 12 terms will be:
|
||||
|
||||
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div>F<sub>1</sub> = 1</div><div>F<sub>2</sub> = 1</div><div>F<sub>3</sub> = 2</div><div>F<sub>4</sub> = 3</div><div>F<sub>5</sub> = 5</div><div>F<sub>6</sub> = 8</div><div>F<sub>7</sub> = 13</div><div>F<sub>8</sub> = 21</div><div>F<sub>9</sub> = 34</div><div>F<sub>10</sub> = 55</div><div>F<sub>11</sub> = 89</div><div>F<sub>12</sub> = 144</div></div>
|
||||
|
||||
The 12th term, F<sub>12</sub>, is the first term to contain three digits.
|
||||
What is the index of the first term in the Fibonacci sequence to contain <var>n</var> digits?
|
||||
|
||||
What is the index of the first term in the Fibonacci sequence to contain `n` digits?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,6 +32,8 @@ What is the index of the first term in the Fibonacci sequence to contain <var>n<
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>digitFibonacci(5)</code> should return a number.
|
||||
testString: assert(typeof digitFibonacci(5) === 'number');
|
||||
- text: <code>digitFibonacci(5)</code> should return 21.
|
||||
testString: assert.strictEqual(digitFibonacci(5), 21);
|
||||
- text: <code>digitFibonacci(10)</code> should return 45.
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 301908
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
|
||||
|
||||
<div style='padding-left: 4em; display: inline-grid; grid-template-rows: auto; row-gap: 7px;'><div><sup>1</sup>/<sub>2</sub> = 0.5</div><div><sup>1</sup>/<sub>3</sub> = 0.(3)</div><div><sup>1</sup>/<sub>4</sub> = 0.25</div><div><sup>1</sup>/<sub>5</sub> = 0.2</div><div><sup>1</sup>/<sub>6</sub> = 0.1(6)</div><div><sup>1</sup>/<sub>7</sub> = 0.(142857)</div><div><sup>1</sup>/<sub>8</sub> = 0.125</div><div><sup>1</sup>/<sub>9</sub> = 0.(1)</div><div><sup>1</sup>/<sub>10</sub> = 0.1</div></div>
|
||||
|
||||
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.
|
||||
Find the value of <var>d</var> < <var>n</var> for which <sup>1</sup>/<sub>d</sub> contains the longest recurring cycle in its decimal fraction part.
|
||||
|
||||
Find the value of <var>d</var> < <var>`n`</var> for which <sup>1</sup>/<sub>d</sub> contains the longest recurring cycle in its decimal fraction part.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ Find the value of <var>d</var> < <var>n</var> for which <sup>1</sup>/<sub>d</sub
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>reciprocalCycles(700)</code> should return a number.
|
||||
testString: assert(typeof reciprocalCycles(700) === 'number');
|
||||
- text: <code>reciprocalCycles(700)</code> should return 659.
|
||||
testString: assert(reciprocalCycles(700) == 659);
|
||||
- text: <code>reciprocalCycles(800)</code> should return 743.
|
||||
|
@ -7,15 +7,25 @@ forumTopicId: 301919
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Euler discovered the remarkable quadratic formula:
|
||||
$n^2 + n + 41$
|
||||
|
||||
<div style='margin-left: 4em;'>$n^2 + n + 41$</div>
|
||||
|
||||
It turns out that the formula will produce 40 primes for the consecutive integer values $0 \le n \le 39$. However, when $n = 40, 40^2 + 40 + 41 = 40(40 + 1) + 41$ is divisible by 41, and certainly when $n = 41, 41^2 + 41 + 41$ is clearly divisible by 41.
|
||||
|
||||
The incredible formula $n^2 - 79n + 1601$ was discovered, which produces 80 primes for the consecutive values $0 \le n \le 79$. The product of the coefficients, −79 and 1601, is −126479.
|
||||
|
||||
Considering quadratics of the form:
|
||||
|
||||
$n^2 + an + b$, where $|a| < range$ and $|b| \le range$where $|n|$ is the modulus/absolute value of $n$e.g. $|11| = 11$ and $|-4| = 4$
|
||||
<div style='margin-left: 4em;'>
|
||||
$n^2 + an + b$, where $|a| < range$ and $|b| \le range$<br>
|
||||
where $|n|$ is the modulus/absolute value of $n$<br>
|
||||
e.g. $|11| = 11$ and $|-4| = 4$<br>
|
||||
</div>
|
||||
|
||||
Find the product of the coefficients, $a$ and $b$, for the quadratic expression that produces the maximum number of primes for consecutive values of $n$, starting with $n = 0$.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -28,6 +38,8 @@ Find the product of the coefficients, $a$ and $b$, for the quadratic expression
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>quadraticPrimes(200)</code> should return a number.
|
||||
testString: assert(typeof quadraticPrimes(200) === 'number');
|
||||
- text: <code>quadraticPrimes(200)</code> should return -4925.
|
||||
testString: assert(quadraticPrimes(200) == -4925);
|
||||
- text: <code>quadraticPrimes(500)</code> should return -18901.
|
||||
|
@ -7,14 +7,21 @@ forumTopicId: 301930
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:
|
||||
21 22 23 24 25
|
||||
20 7 8 9 10
|
||||
19 6 1 2 11
|
||||
18 5 4 3 12
|
||||
17 16 15 14 13
|
||||
|
||||
<div style='padding-left: 4em;'>
|
||||
<div style='color: red; display: inline;'>21</div> 22 23 24 <div style='color: red; display: inline;'>25</div><br>
|
||||
20 <div style='color: red; display: inline;'>7</div> 8 <div style='color: red; display: inline;'>9</div> 10<br>
|
||||
19 6 <div style='color: red; display: inline;'>1</div> 2 11<br>
|
||||
18 <div style='color: red; display: inline;'>5</div> 4 <div style='color: red; display: inline;'>3</div> 12<br>
|
||||
<div style='color: red; display: inline;'>17</div> 16 15 14 <div style='color: red; display: inline;'>13</div><br>
|
||||
</div>
|
||||
|
||||
It can be verified that the sum of the numbers on the diagonals is 101.
|
||||
What is the sum of the numbers on the diagonals in a n by n spiral formed in the same way?
|
||||
|
||||
What is the sum of the numbers on the diagonals in an `n` by `n` spiral formed in the same way?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -27,6 +34,8 @@ What is the sum of the numbers on the diagonals in a n by n spiral formed in the
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>spiralDiagonals(101)</code> should return a number.
|
||||
testString: assert(typeof spiralDiagonals(101) === 'number');
|
||||
- text: <code>spiralDiagonals(101)</code> should return 692101.
|
||||
testString: assert(spiralDiagonals(101) == 692101);
|
||||
- text: <code>spiralDiagonals(303)</code> should return 18591725.
|
||||
|
@ -7,14 +7,24 @@ forumTopicId: 301941
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
|
||||
22=4, 23=8, 24=16, 25=32
|
||||
32=9, 33=27, 34=81, 35=243
|
||||
42=16, 43=64, 44=256, 45=1024
|
||||
52=25, 53=125, 54=625, 55=3125
|
||||
|
||||
<div style='padding-left: 4em;'>
|
||||
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>
|
||||
</div>
|
||||
|
||||
If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:
|
||||
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
|
||||
How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ n and 2 ≤ b ≤ n?
|
||||
|
||||
<div style='padding-left: 4em;'>
|
||||
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
|
||||
</div>
|
||||
|
||||
How many distinct terms are in the sequence generated by <var>a<sup>b</sup></var> for 2 ≤ <var>a</var> ≤ <var>`n`</var> and 2 ≤ <var>b</var> ≤ <var>`n`</var>?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -27,6 +37,8 @@ How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ n an
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>distinctPowers(15)</code> should return a number.
|
||||
testString: assert(typeof distinctPowers(15) === 'number');
|
||||
- text: <code>distinctPowers(15)</code> should return 177.
|
||||
testString: assert.strictEqual(distinctPowers(15), 177);
|
||||
- text: <code>distinctPowers(20)</code> should return 324.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 301952
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The prime factors of 13195 are 5, 7, 13 and 29.
|
||||
What is the largest prime factor of the given <code>number</code>?
|
||||
|
||||
What is the largest prime factor of the given `number`?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ What is the largest prime factor of the given <code>number</code>?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largestPrimeFactor(2)</code> should return a number.
|
||||
testString: assert(typeof largestPrimeFactor(2) === 'number');
|
||||
- text: <code>largestPrimeFactor(2)</code> should return 2.
|
||||
testString: assert.strictEqual(largestPrimeFactor(2), 2);
|
||||
- text: <code>largestPrimeFactor(3)</code> should return 3.
|
||||
|
@ -7,13 +7,21 @@ forumTopicId: 301953
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
|
||||
1634 = 1<sup>4</sup> + 6<sup>4</sup> + 3<sup>4</sup> + 4<sup>4</sup>
|
||||
8208 = 8<sup>4</sup> + 2<sup>4</sup> + 0<sup>4</sup> + 8<sup>4</sup>
|
||||
9474 = 9<sup>4</sup> + 4<sup>4</sup> + 7<sup>4</sup> + 4<sup>4</sup>
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
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><br>
|
||||
</div>
|
||||
|
||||
As 1 = 1<sup>4</sup> is not a sum it is not included.
|
||||
|
||||
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
|
||||
Find the sum of all the numbers that can be written as the sum of n powers of their digits.
|
||||
|
||||
Find the sum of all the numbers that can be written as the sum of `n` powers of their digits.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -26,6 +34,8 @@ Find the sum of all the numbers that can be written as the sum of n powers of th
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>digitnPowers(2)</code> should return a number.
|
||||
testString: assert(typeof digitnPowers(2) === 'number');
|
||||
- text: <code>digitnPowers(2)</code> should return 0.
|
||||
testString: assert(digitnPowers(2) == 0);
|
||||
- text: <code>digitnPowers(3)</code> should return 1301.
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 301965
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
|
||||
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
|
||||
|
||||
<div style='margin-left: 4em;'>1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).</div>
|
||||
|
||||
It is possible to make £2 in the following way:
|
||||
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
|
||||
How many different ways can n pence be made using any number of coins?
|
||||
|
||||
<div style='margin-left: 4em;'>1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p</div>
|
||||
|
||||
How many different ways can `n` pence be made using any number of coins?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,6 +30,8 @@ How many different ways can n pence be made using any number of coins?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>coinSums(50)</code> should return a number.
|
||||
testString: assert(typeof coinSums(50) === 'number');
|
||||
- text: <code>coinSums(50)</code> should return 451.
|
||||
testString: assert(coinSums(50) == 451);
|
||||
- text: <code>coinSums(100)</code> should return 4563.
|
||||
|
@ -7,13 +7,15 @@ forumTopicId: 301976
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
|
||||
|
||||
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.
|
||||
|
||||
The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.
|
||||
|
||||
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
|
||||
|
||||
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.
|
||||
**Hint:** Some products can be obtained in more than one way so be sure to only include it once in your sum.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -26,8 +28,8 @@ HINT: Some products can be obtained in more than one way so be sure to only incl
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>pandigitalProducts()</code> should be a function.
|
||||
testString: assert(typeof pandigitalProducts === 'function');
|
||||
- text: <code>pandigitalProducts()</code> should return a number.
|
||||
testString: assert(typeof pandigitalProducts() === 'number');
|
||||
- text: <code>pandigitalProducts()</code> should return 45228.
|
||||
testString: assert.strictEqual(pandigitalProducts(), 45228);
|
||||
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 301987
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
|
||||
We shall consider fractions like, <sup>30</sup>/<sub>50</sub> = <sup>3</sup>/<sub>5</sub>, to be trivial examples.
|
||||
|
||||
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.
|
||||
|
||||
If the product of these four fractions is given in its lowest common terms, find the value of the denominator.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ If the product of these four fractions is given in its lowest common terms, find
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>digitCancellingFractions()</code> should return a number.
|
||||
testString: assert(typeof digitCancellingFractions() === 'number');
|
||||
- text: <code>digitCancellingFractions()</code> should return 100.
|
||||
testString: assert.strictEqual(digitCancellingFractions(), 100);
|
||||
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 301998
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
|
||||
|
||||
Find the numbers and the sum of the numbers which are equal to the sum of the factorial of their digits.
|
||||
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
|
||||
|
||||
**Note:** as 1! = 1 and 2! = 2 are not sums they are not included.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,12 @@ Note: as 1! = 1 and 2! = 2 are not sums they are not included.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: '<code>digitFactorial()</code> should return { sum: 40730, numbers: [145, 40585] }.'
|
||||
testString: "assert.deepEqual(digitFactorial(), { sum: 40730, numbers: [145, 40585] });"
|
||||
- text: <code>digitFactorial()</code> should return an object.
|
||||
testString: assert.typeOf(digitFactorial(), 'object');
|
||||
- text: |
|
||||
<code>digitFactorial()</code> should return { sum: 40730, numbers: [145, 40585] }.
|
||||
testString: |
|
||||
assert.deepEqual(digitFactorial(), { sum: 40730, numbers: [145, 40585] });
|
||||
|
||||
```
|
||||
|
||||
|
@ -7,12 +7,17 @@ forumTopicId: 302009
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
|
||||
|
||||
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
|
||||
How many circular primes are there below n, whereas 100 <= n <= 1000000?
|
||||
|
||||
How many circular primes are there below `n`, whereas 100 ≤ `n` ≤ 1000000?
|
||||
|
||||
<br><strong>Note:</strong><br>
|
||||
|
||||
Circular primes individual rotation can exceed `n`.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,6 +30,8 @@ Circular primes individual rotation can exceed `n`.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>circularPrimes(100)</code> should return a number.
|
||||
testString: assert(typeof circularPrimes(100) === 'number');
|
||||
- text: <code>circularPrimes(100)</code> should return 13.
|
||||
testString: assert(circularPrimes(100) == 13);
|
||||
- text: <code>circularPrimes(100000)</code> should return 43.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302020
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
|
||||
Find the sum of all numbers, less than n, whereas 1000 <= n <= 1000000, which are palindromic in base 10 and base 2.
|
||||
|
||||
The decimal number, 585 = 1001001001<sub>2</sub> (binary), is palindromic in both bases.
|
||||
|
||||
Find the sum of all numbers, less than `n`, whereas 1000 ≤ `n` ≤ 1000000, which are palindromic in base 10 and base 2.
|
||||
|
||||
(Please note that the palindromic number, in either base, may not include leading zeros.)
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ Find the sum of all numbers, less than n, whereas 1000 <= n <= 1000000, which ar
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>doubleBasePalindromes(1000)</code> should return a number.
|
||||
testString: assert(typeof doubleBasePalindromes(1000) === 'number');
|
||||
- text: <code>doubleBasePalindromes(1000)</code> should return 1772.
|
||||
testString: assert(doubleBasePalindromes(1000) == 1772);
|
||||
- text: <code>doubleBasePalindromes(50000)</code> should return 105795.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302031
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
Find the sum of the only n (8 <= n <= 11) primes that are both truncatable from left to right and right to left.
|
||||
|
||||
Find the sum of the only `n` (8 ≤ `n` ≤ 11) primes that are both truncatable from left to right and right to left.
|
||||
|
||||
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>truncatablePrimes(8)</code> should return a number.
|
||||
testString: assert(typeof truncatablePrimes(8) === 'number');
|
||||
- text: <code>truncatablePrimes(8)</code> should return 1986.
|
||||
testString: assert(truncatablePrimes(8) == 1986);
|
||||
- text: <code>truncatablePrimes(9)</code> should return 5123.
|
||||
|
@ -7,13 +7,21 @@ forumTopicId: 302042
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Take the number 192 and multiply it by each of 1, 2, and 3:
|
||||
192 × 1 = 192
|
||||
192 × 2 = 384
|
||||
192 × 3 = 576
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
192 × 1 = 192<br>
|
||||
192 × 2 = 384<br>
|
||||
192 × 3 = 576<br>
|
||||
</div>
|
||||
|
||||
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).
|
||||
|
||||
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).
|
||||
|
||||
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> > 1?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -26,6 +34,8 @@ What is the largest 1 to 9 pandigital 9-digit number that can be formed as the c
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>pandigitalMultiples()</code> should return a number.
|
||||
testString: assert(typeof pandigitalMultiples() === 'number');
|
||||
- text: <code>pandigitalMultiples()</code> should return 932718654.
|
||||
testString: assert.strictEqual(pandigitalMultiples(), 932718654);
|
||||
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302054
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.
|
||||
|
||||
If <var>p</var> is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.
|
||||
|
||||
{20,48,52}, {24,45,51}, {30,40,50}
|
||||
For which value of p ≤ n, is the number of solutions maximised?
|
||||
|
||||
For which value of <var>p</var> ≤ `n`, is the number of solutions maximized?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ For which value of p ≤ n, is the number of solutions maximised?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>intRightTriangles(500)</code> should return a number.
|
||||
testString: assert(typeof intRightTriangles(500) === 'number');
|
||||
- text: <code>intRightTriangles(500)</code> should return 420.
|
||||
testString: assert(intRightTriangles(500) == 420);
|
||||
- text: <code>intRightTriangles(800)</code> should return 720.
|
||||
@ -46,7 +52,7 @@ function intRightTriangles(n) {
|
||||
return n;
|
||||
}
|
||||
|
||||
console.log(intRightTriangles(500)); // 420
|
||||
intRightTriangles(500);
|
||||
```
|
||||
|
||||
</div>
|
||||
@ -81,7 +87,7 @@ function intRightTriangles(n) {
|
||||
for (let p in triangles) {
|
||||
if (max < triangles[p]) {
|
||||
max = triangles[p];
|
||||
maxp = p;
|
||||
maxp = parseInt(p);
|
||||
}
|
||||
}
|
||||
return maxp;
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302065
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
|
||||
Find the largest palindrome made from the product of two <code>n</code>-digit numbers.
|
||||
|
||||
Find the largest palindrome made from the product of two `n`-digit numbers.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ Find the largest palindrome made from the product of two <code>n</code>-digit nu
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largestPalindromeProduct(2)</code> should return a number.
|
||||
testString: assert(typeof largestPalindromeProduct(2) === 'number');
|
||||
- text: <code>largestPalindromeProduct(2)</code> should return 9009.
|
||||
testString: assert.strictEqual(largestPalindromeProduct(2), 9009);
|
||||
- text: <code>largestPalindromeProduct(3)</code> should return 906609.
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302066
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
An irrational decimal fraction is created by concatenating the positive integers:
|
||||
|
||||
<span style='display: block; text-align: center;'>0.12345678910<b style='color: red;'>1</b>112131415161718192021...</span>
|
||||
|
||||
It can be seen that the 12<sup>th</sup> digit of the fractional part is 1.
|
||||
|
||||
If <i>d<sub>n</sub></i> represents the <i>n</i><sup>th</sup> digit of the fractional part, find the value of the following expression.
|
||||
|
||||
<span style='display: block; text-align: center;'>d<sub>1</sub> × d<sub>10</sub> × d<sub>100</sub> × d<sub>1000</sub> × d<sub>10000</sub> × d<sub>100000</sub> × d<sub>1000000</sub></span>
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,6 +30,8 @@ If <i>d<sub>n</sub></i> represents the <i>n</i><sup>th</sup> digit of the fracti
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>champernownesConstant(100)</code> should return a number.
|
||||
testString: assert(typeof champernownesConstant(100) === 'number');
|
||||
- text: <code>champernownesConstant(100)</code> should return 5.
|
||||
testString: assert.strictEqual(champernownesConstant(100), 5);
|
||||
- text: <code>champernownesConstant(1000)</code> should return 15.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302078
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
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.
|
||||
What is the largest <i>n</i>-length digit pandigital prime that exists?
|
||||
|
||||
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, 2143 is a 4-digit pandigital and is also prime.
|
||||
|
||||
What is the largest `n`-length digit pandigital prime that exists?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ What is the largest <i>n</i>-length digit pandigital prime that exists?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>pandigitalPrime(4)</code> should return a number.
|
||||
testString: assert(typeof pandigitalPrime(4) === 'number');
|
||||
- text: <code>pandigitalPrime(4)</code> should return 4231.
|
||||
testString: assert(pandigitalPrime(4) == 4231);
|
||||
- text: <code>pandigitalPrime(7)</code> should return 7652413.
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 302089
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
|
||||
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
|
||||
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 = t10. If the word value is a triangle number then we shall call the word a triangle word.
|
||||
Using words array of n-length, how many are triangle words?
|
||||
|
||||
The <var>n</var><sup>th</sup> term of the sequence of triangle numbers is given by, <var>t<sub>n</sub></var> = ½<var>n</var>(<var>n</var>+1); so the first ten triangle numbers are:
|
||||
|
||||
<div style='margin-left: 4em;'>1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...</div>
|
||||
|
||||
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 = <var>t</var><sub>10</sub>. If the word value is a triangle number then we shall call the word a triangle word.
|
||||
|
||||
Using words array of `n`-length, how many are triangle words?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ Using words array of n-length, how many are triangle words?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>codedTriangleNumbers(1400)</code> should return a number.
|
||||
testString: assert(typeof codedTriangleNumbers(1400) === 'number');
|
||||
- text: <code>codedTriangleNumbers(1400)</code> should return 129.
|
||||
testString: assert(codedTriangleNumbers(1400) == 129);
|
||||
- text: <code>codedTriangleNumbers(1500)</code> should return 137.
|
||||
|
@ -7,16 +7,23 @@ forumTopicId: 302100
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:
|
||||
d2d3d4=406 is divisible by 2
|
||||
d3d4d5=063 is divisible by 3
|
||||
d4d5d6=635 is divisible by 5
|
||||
d5d6d7=357 is divisible by 7
|
||||
d6d7d8=572 is divisible by 11
|
||||
d7d8d9=728 is divisible by 13
|
||||
d8d9d10=289 is divisible by 17
|
||||
|
||||
Let d<sub>1</sub> be the 1<sup>st</sup> digit, d<sub>2</sub> be the 2<sup>nd</sup> digit, and so on. In this way, we note the following:
|
||||
|
||||
<ul>
|
||||
<li>d<sub>2</sub>d<sub>3</sub>d<sub>4</sub> = 406 is divisible by 2</li>
|
||||
<li>d<sub>3</sub>d<sub>4</sub>d<sub>5</sub> = 063 is divisible by 3</li>
|
||||
<li>d<sub>4</sub>d<sub>5</sub>d<sub>6</sub> = 635 is divisible by 5</li>
|
||||
<li>d<sub>5</sub>d<sub>6</sub>d<sub>7</sub> = 357 is divisible by 7</li>
|
||||
<li>d<sub>6</sub>d<sub>7</sub>d<sub>8</sub> = 572 is divisible by 11</li>
|
||||
<li>d<sub>7</sub>d<sub>8</sub>d<sub>9</sub> = 728 is divisible by 13</li>
|
||||
<li>d<sub>8</sub>d<sub>9</sub>d<sub>10</sub> = 289 is divisible by 17</li>
|
||||
</ul>
|
||||
|
||||
Find the numbers of all 0 to 9 pandigital numbers with this property.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -29,6 +36,8 @@ Find the numbers of all 0 to 9 pandigital numbers with this property.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>substringDivisibility()</code> should return an array.
|
||||
testString: assert(Array.isArray(substringDivisibility()));
|
||||
- text: <code>substringDivisibility()</code> should return [ 1430952867, 1460357289, 1406357289, 4130952867, 4160357289, 4106357289 ].
|
||||
testString: assert.deepEqual(substringDivisibility(), [ 1430952867, 1460357289, 1406357289, 4130952867, 4160357289, 4106357289 ]);
|
||||
|
||||
|
@ -7,10 +7,15 @@ forumTopicId: 302111
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Pentagonal numbers are generated by the formula, P<sub>n</sub>=<var>n</var>(3<var>n</var>−1)/2. The first ten pentagonal numbers are:
|
||||
|
||||
<span style='display: block; text-align: center;'>1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...</span>
|
||||
|
||||
It can be seen that P<sub>4</sub> + P<sub>7</sub> = 22 + 70 = 92 = P<sub>8</sub>. However, their difference, 70 − 22 = 48, is not pentagonal.
|
||||
Find the pair of pentagonal numbers, P<sub>j</sub> and P<sub>k</sub>, for which their sum and difference are pentagonal and D = |P<sub>k</sub> − P<sub>j</sub>| is minimised; what is the value of D?
|
||||
|
||||
Find the pair of pentagonal numbers, P<sub>j</sub> and P<sub>k</sub>, for which their sum and difference are pentagonal and D = |P<sub>k</sub> − P<sub>j</sub>| is minimized; what is the value of D?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,6 +28,8 @@ Find the pair of pentagonal numbers, P<sub>j</sub> and P<sub>k</sub>, for which
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>pentagonNumbers()</code> should return a number.
|
||||
testString: assert(typeof pentagonNumbers() === 'number');
|
||||
- text: <code>pentagonNumbers()</code> should return 5482660.
|
||||
testString: assert.strictEqual(pentagonNumbers(), 5482660);
|
||||
|
||||
|
@ -7,12 +7,17 @@ forumTopicId: 302122
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: repeat(3, minmax(117px, 12%)); grid-template-rows: auto;'><div>Triangle</div><div>T<sub>n</sub>=<var>n</var>(<var>n</var>+1)/2</div><div>1, 3, 6, 10, 15, ...</div></div>
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: repeat(3, minmax(117px, 12%)); grid-template-rows: auto;'><div>Pentagonal</div><div>P<sub>n</sub>=<var>n</var>(3<var>n</var>−1)/2</div><div>1, 5, 12, 22, 35, ...</div></div>
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: repeat(3, minmax(117px, 12%)); grid-template-rows: auto;'><div>Hexagonal</div><div>H<sub>n</sub>=<var>n</var>(2<var>n</var>−1)</div><div>1, 6, 15, 28, 45, ...</div></div>
|
||||
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: 135px 135px 260px; grid-template-rows: auto;'><div>Triangle</div><div>T<sub>n</sub>=<var>n</var>(<var>n</var>+1)/2</div><div>1, 3, 6, 10, 15, ...</div></div>
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: 135px 135px 260px; grid-template-rows: auto;'><div>Pentagonal</div><div>P<sub>n</sub>=<var>n</var>(3<var>n</var>−1)/2</div><div>1, 5, 12, 22, 35, ...</div></div>
|
||||
<div style='display: inline-grid; text-align: center; grid-template-columns: 135px 135px 260px; grid-template-rows: auto;'><div>Hexagonal</div><div>H<sub>n</sub>=<var>n</var>(2<var>n</var>−1)</div><div>1, 6, 15, 28, 45, ...</div></div>
|
||||
|
||||
It can be verified that T<sub>285</sub> = P<sub>165</sub> = H<sub>143</sub> = 40755.
|
||||
|
||||
Find the next triangle number that is also pentagonal and hexagonal.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,6 +30,8 @@ Find the next triangle number that is also pentagonal and hexagonal.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>triPentaHexa(40756)</code> should return a number.
|
||||
testString: assert(typeof triPentaHexa(40756) === 'number');
|
||||
- text: <code>triPentaHexa(40756)</code> should return 1533776805.
|
||||
testString: assert.strictEqual(triPentaHexa(40756), 1533776805);
|
||||
|
||||
|
@ -7,15 +7,22 @@ forumTopicId: 302134
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.
|
||||
9 = 7 + 2×1<sup>2</sup>
|
||||
15 = 7 + 2×2<sup>2</sup>
|
||||
21 = 3 + 2×3<sup>2</sup>
|
||||
25 = 7 + 2×3<sup>2</sup>
|
||||
27 = 19 + 2×2<sup>2</sup>
|
||||
33 = 31 + 2×1<sup>2</sup>
|
||||
|
||||
<div style='margin-left: 2em;'>
|
||||
9 = 7 + 2×1<sup>2</sup><br>
|
||||
15 = 7 + 2×2<sup>2</sup><br>
|
||||
21 = 3 + 2×3<sup>2</sup><br>
|
||||
25 = 7 + 2×3<sup>2</sup><br>
|
||||
27 = 19 + 2×2<sup>2</sup><br>
|
||||
33 = 31 + 2×1<sup>2</sup>
|
||||
</div>
|
||||
|
||||
It turns out that the conjecture was false.
|
||||
|
||||
What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -28,6 +35,8 @@ What is the smallest odd composite that cannot be written as the sum of a prime
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>goldbachsOtherConjecture()</code> should return a number.
|
||||
testString: assert(typeof goldbachsOtherConjecture() === 'number');
|
||||
- text: <code>goldbachsOtherConjecture()</code> should return 5777.
|
||||
testString: assert.strictEqual(goldbachsOtherConjecture(), 5777);
|
||||
|
||||
|
@ -7,14 +7,24 @@ forumTopicId: 302145
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The first two consecutive numbers to have two distinct prime factors are:
|
||||
<div style='padding-left: 4em;'>14 = 2 × 7</div>
|
||||
<div style='padding-left: 4em;'>15 = 3 × 5</div>
|
||||
|
||||
<div style='padding-left: 4em;'>
|
||||
14 = 2 × 7<br>
|
||||
15 = 3 × 5
|
||||
</div>
|
||||
|
||||
The first three consecutive numbers to have three distinct prime factors are:
|
||||
<div style='padding-left: 4em;'>644 = 2² × 7 × 23</div>
|
||||
<div style='padding-left: 4em;'>645 = 3 × 5 × 43</div>
|
||||
<div style='padding-left: 4em;'>646 = 2 × 17 × 19</div>
|
||||
|
||||
<div style='padding-left: 4em;'>
|
||||
644 = 2<sup>2</sup> × 7 × 23<br>
|
||||
645 = 3 × 5 × 43<br>
|
||||
646 = 2 × 17 × 19
|
||||
</div>
|
||||
|
||||
Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -27,6 +37,8 @@ Find the first four consecutive integers to have four distinct prime factors eac
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>distinctPrimeFactors(2, 2)</code> should return a number.
|
||||
testString: assert(typeof distinctPrimeFactors(2, 2) === 'number');
|
||||
- text: <code>distinctPrimeFactors(2, 2)</code> should return 14.
|
||||
testString: assert.strictEqual(distinctPrimeFactors(2, 2), 14);
|
||||
- text: <code>distinctPrimeFactors(3, 3)</code> should return 644.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302157
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 10<sup>10</sup> = 10405071317.
|
||||
|
||||
Find the last ten digits of the series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 1000<sup>1000</sup>.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ Find the last ten digits of the series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3<
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>selfPowers(10, 3)</code> should return a number.
|
||||
testString: assert(typeof selfPowers(10, 3) === 'number');
|
||||
- text: <code>selfPowers(10, 3)</code> should return 317.
|
||||
testString: assert.strictEqual(selfPowers(10, 3), 317);
|
||||
- text: <code>selfPowers(150, 6)</code> should return 29045.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302159
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
What 12-digit number do you form by concatenating the three terms in this sequence?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,6 +26,8 @@ What 12-digit number do you form by concatenating the three terms in this sequen
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>primePermutations()</code> should return a number.
|
||||
testString: assert(typeof primePermutations() === 'number');
|
||||
- text: <code>primePermutations()</code> should return 296962999629.
|
||||
testString: assert.strictEqual(primePermutations(), 296962999629);
|
||||
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302160
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
|
||||
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to <code>n</code>?
|
||||
|
||||
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to `n`?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ What is the smallest positive number that is evenly divisible by all of the numb
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>smallestMult(5)</code> should return a number.
|
||||
testString: assert(typeof smallestMult(5) === 'number');
|
||||
- text: <code>smallestMult(5)</code> should return 60.
|
||||
testString: assert.strictEqual(smallestMult(5), 60);
|
||||
- text: <code>smallestMult(7)</code> should return 420.
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302161
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The prime 41, can be written as the sum of six consecutive primes:
|
||||
41 = 2 + 3 + 5 + 7 + 11 + 13
|
||||
|
||||
<div style='text-align: center;'>41 = 2 + 3 + 5 + 7 + 11 + 13</div>
|
||||
|
||||
This is the longest sum of consecutive primes that adds to a prime below one-hundred.
|
||||
|
||||
The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.
|
||||
|
||||
Which prime, below one-million, can be written as the sum of the most consecutive primes?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,6 +30,8 @@ Which prime, below one-million, can be written as the sum of the most consecutiv
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>consecutivePrimeSum(1000)</code> should return a number.
|
||||
testString: assert(typeof consecutivePrimeSum(1000) === 'number');
|
||||
- text: <code>consecutivePrimeSum(1000)</code> should return 953.
|
||||
testString: assert.strictEqual(consecutivePrimeSum(1000), 953);
|
||||
- text: <code>consecutivePrimeSum(1000000)</code> should return 997651.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302162
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
By replacing the 1st 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.
|
||||
|
||||
By replacing the 3rd and 4th 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.
|
||||
|
||||
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.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ Find the smallest prime which, by replacing part of the number (not necessarily
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler51()</code> should return 121313.
|
||||
testString: assert.strictEqual(euler51(), 121313);
|
||||
- text: <code>primeDigitReplacements()</code> should return a number.
|
||||
testString: assert(typeof primeDigitReplacements() === 'number');
|
||||
- text: <code>primeDigitReplacements()</code> should return 121313.
|
||||
testString: assert.strictEqual(primeDigitReplacements(), 121313);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler51() {
|
||||
function primeDigitReplacements() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler51();
|
||||
primeDigitReplacements();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302163
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
|
||||
Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
|
||||
|
||||
Find the smallest positive integer, <var>x</var>, such that <var>2x</var>, <var>3x</var>, <var>4x</var>, <var>5x</var>, and <var>6x</var>, contain the same digits.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>permutedMultiples()</code> should return a number.
|
||||
testString: assert(typeof permutedMultiples() === 'number');
|
||||
- text: <code>permutedMultiples()</code> should return 142857.
|
||||
testString: assert.strictEqual(permutedMultiples(), 142857);
|
||||
|
||||
|
@ -7,17 +7,19 @@ forumTopicId: 302164
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
There are exactly ten ways of selecting three from five, 12345:
|
||||
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
|
||||
In combinatorics, we use the notation, 5C3 = 10.
|
||||
In general,
|
||||
|
||||
nCr =
|
||||
n!r!(n−r)!
|
||||
,where r ≤ n, n! = n×(n−1)×...×3×2×1, and 0! = 1.
|
||||
<div style='text-align: center;'>123, 124, 125, 134, 135, 145, 234, 235, 245, and 345</div>
|
||||
|
||||
In combinatorics, we use the notation, $\displaystyle \binom 5 3 = 10$
|
||||
|
||||
In general, $\displaystyle \binom n r = \dfrac{n!}{r!(n-r)!}$, where $r \le n$, $n! = n \times (n-1) \times ... \times 3 \times 2 \times 1$, and $0! = 1$.
|
||||
|
||||
It is not until $n = 23$, that a value exceeds one-million: $\displaystyle \binom {23} {10} = 1144066$.
|
||||
|
||||
How many, not necessarily distinct, values of $\displaystyle \binom n r$ for $1 \le n \le 100$, are greater than one-million?
|
||||
|
||||
It is not until n = 23, that a value exceeds one-million: 23C10 = 1144066.
|
||||
How many, not necessarily distinct, values of nCr, for 1 ≤ n ≤ 100, are greater than one-million?
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -30,6 +32,8 @@ How many, not necessarily distinct, values of nCr, for 1 ≤ n ≤ 100, are gr
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>combinatoricSelections(1000)</code> should return a number.
|
||||
testString: assert(typeof combinatoricSelections(1000) === 'number');
|
||||
- text: <code>combinatoricSelections(1000)</code> should return 4626.
|
||||
testString: assert.strictEqual(combinatoricSelections(1000), 4626);
|
||||
- text: <code>combinatoricSelections(10000)</code> should return 4431.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,16 +7,27 @@ forumTopicId: 302166
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
|
||||
|
||||
Not all numbers produce palindromes so quickly. For example,
|
||||
349 + 943 = 1292,
|
||||
1292 + 2921 = 4213
|
||||
4213 + 3124 = 7337
|
||||
|
||||
<div style="margin-left: 4em;">
|
||||
349 + 943 = 1292,<br>
|
||||
1292 + 2921 = 4213<br>
|
||||
4213 + 3124 = 7337<br>
|
||||
</div>
|
||||
|
||||
That is, 349 took three iterations to arrive at a palindrome.
|
||||
|
||||
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).
|
||||
|
||||
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.
|
||||
|
||||
How many Lychrel numbers are there below <code>num</code>?
|
||||
NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.
|
||||
|
||||
**Note:** Wording was modified slightly on 24 April 2007 to emphasize the theoretical nature of Lychrel numbers.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -29,16 +40,18 @@ NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretica
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>countLychrelNumbers(1000)</code> should return a number.
|
||||
testString: assert(typeof countLychrelNumbers(1000) === 'number');
|
||||
- text: <code>countLychrelNumbers(1000)</code> should return 13.
|
||||
testString: assert.strictEqual(countLychrelNumbers(1000), 13);
|
||||
- text: <code>countLychrelNumbers(3243)</code> should return 39.
|
||||
testString: assert.strictEqual(countLychrelNumbers(3243), 39);
|
||||
- text: <code>countLychrelNumbers(5000)</code> should return 76.
|
||||
testString: assert.strictEqual(countLychrelNumbers(5000), 76);
|
||||
- text: <code>countLychrelNumbers(7654)</code> should return 140.
|
||||
testString: assert.strictEqual(countLychrelNumbers(7654), 140);
|
||||
- text: <code>countLychrelNumbers(10000)</code> should return 249.
|
||||
testString: assert.strictEqual(countLychrelNumbers(10000), 249);
|
||||
- text: Your function should count all Lychrel numbers.
|
||||
testString: assert.strictEqual(countLychrelNumbers(3243), 39);
|
||||
- text: Your function should pass all test cases.
|
||||
testString: assert.strictEqual(countLychrelNumbers(7654), 140);
|
||||
|
||||
```
|
||||
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302167
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
A googol (10100) is a massive number: one followed by one-hundred zeros; 100100 is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.
|
||||
Considering natural numbers of the form, ab, where a, b < 100, what is the maximum digital sum?
|
||||
|
||||
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.
|
||||
|
||||
Considering natural numbers of the form, <var>a<sup>b</sup></var>, where <var>a</var>, <var>b</var> < 100, what is the maximum digital sum?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,8 +24,10 @@ Considering natural numbers of the form, ab, where a, b < 100, what is the maxim
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler56()</code> should return 972.
|
||||
testString: assert.strictEqual(euler56(), 972);
|
||||
- text: <code>powerfulDigitSum()</code> should return a number.
|
||||
testString: assert(typeof powerfulDigitSum() === 'number');
|
||||
- text: <code>powerfulDigitSum()</code> should return 972.
|
||||
testString: assert.strictEqual(powerfulDigitSum(), 972);
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +39,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler56() {
|
||||
function powerfulDigitSum() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler56();
|
||||
powerfulDigitSum();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,15 +7,25 @@ forumTopicId: 302168
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It is possible to show that the square root of two can be expressed as an infinite continued fraction.
|
||||
√ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
|
||||
|
||||
<div style='text-align: center;'>$\sqrt 2 =1+ \frac 1 {2+ \frac 1 {2 +\frac 1 {2+ \dots}}}$</div>
|
||||
|
||||
By expanding this for the first four iterations, we get:
|
||||
1 + 1/2 = 3/2 = 1.5
|
||||
1 + 1/(2 + 1/2) = 7/5 = 1.4
|
||||
1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666...
|
||||
1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379...
|
||||
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.
|
||||
|
||||
$1 + \frac 1 2 = \frac 32 = 1.5$
|
||||
|
||||
$1 + \frac 1 {2 + \frac 1 2} = \frac 7 5 = 1.4$
|
||||
|
||||
$1 + \frac 1 {2 + \frac 1 {2+\frac 1 2}} = \frac {17}{12} = 1.41666 \dots$
|
||||
|
||||
$1 + \frac 1 {2 + \frac 1 {2+\frac 1 {2+\frac 1 2}}} = \frac {41}{29} = 1.41379 \dots$
|
||||
|
||||
The next three expansions are $\frac {99}{70}$, $\frac {239}{169}$, and $\frac {577}{408}$, but the eighth expansion, $\frac {1393}{985}$, is the first example where the number of digits in the numerator exceeds the number of digits in the denominator.
|
||||
|
||||
In the first one-thousand expansions, how many fractions contain a numerator with more digits than denominator?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -28,8 +38,10 @@ In the first one-thousand expansions, how many fractions contain a numerator wit
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler57()</code> should return 153.
|
||||
testString: assert.strictEqual(euler57(), 153);
|
||||
- text: <code>squareRootConvergents()</code> should return a number.
|
||||
testString: assert(typeof squareRootConvergents() === 'number');
|
||||
- text: <code>squareRootConvergents()</code> should return 153.
|
||||
testString: assert.strictEqual(squareRootConvergents(), 153);
|
||||
|
||||
```
|
||||
|
||||
@ -41,12 +53,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler57() {
|
||||
function squareRootConvergents() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler57();
|
||||
squareRootConvergents();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,15 +7,23 @@ forumTopicId: 302169
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed.
|
||||
37 36 35 34 33 32 31
|
||||
38 17 16 15 14 13 30
|
||||
39 18 5 4 3 12 29
|
||||
40 19 6 1 2 11 28
|
||||
41 20 7 8 9 10 27
|
||||
42 21 22 23 24 25 2643 44 45 46 47 48 49
|
||||
|
||||
<div style='text-align: center;'>
|
||||
<strong><span style='color: red;'>37</span></strong> 36 35 34 33 32 <strong><span style='color: red;'>31</span></strong><br>
|
||||
38 <strong><span style='color: red;'>17</span></strong> 16 15 14 <strong><span style='color: red;'>13</span></strong> 30<br>
|
||||
39 18 <strong><span style='color: red;'>5</span></strong> 4 <strong><span style='color: red;'>3</span></strong> 12 29<br>
|
||||
40 19 6 1 2 11 28<br>
|
||||
41 20 <strong><span style='color: red;'>7</span></strong> 8 9 10 27<br>
|
||||
42 21 22 23 24 25 26<br>
|
||||
<strong><span style='color: red;'>43</span></strong> 44 45 46 47 48 49<br>
|
||||
</div>
|
||||
|
||||
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 ≈ 62%.
|
||||
|
||||
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%?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -28,8 +36,10 @@ If one complete new layer is wrapped around the spiral above, a square spiral wi
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler58()</code> should return 26241.
|
||||
testString: assert.strictEqual(euler58(), 26241);
|
||||
- text: <code>spiralPrimes()</code> should return a number.
|
||||
testString: assert(typeof spiralPrimes() === 'number');
|
||||
- text: <code>spiralPrimes()</code> should return 26241.
|
||||
testString: assert.strictEqual(spiralPrimes(), 26241);
|
||||
|
||||
```
|
||||
|
||||
@ -41,12 +51,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler58() {
|
||||
function spiralPrimes() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler58();
|
||||
spiralPrimes();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302170
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
Your task has been made easy, as the encryption key consists of three lower case characters. Using cipher.txt (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.
|
||||
|
||||
Your task has been made easy, as the encryption key consists of three lower case characters. Using `cipher`, an array 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.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,8 +30,10 @@ Your task has been made easy, as the encryption key consists of three lower case
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler59()</code> should return 107359.
|
||||
testString: assert.strictEqual(euler59(), 107359);
|
||||
- text: <code>XORDecryption(cipher)</code> should return a number.
|
||||
testString: assert(typeof XORDecryption(cipher) === 'number');
|
||||
- text: <code>XORDecryption(cipher)</code> should return 107359.
|
||||
testString: assert.strictEqual(XORDecryption(cipher), 107359);
|
||||
|
||||
```
|
||||
|
||||
@ -37,12 +45,18 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler59() {
|
||||
function XORDecryption(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler59();
|
||||
// Only change code above this line
|
||||
|
||||
const cipher = [
|
||||
36,22,80,0,0,4,23,25,19,17,88,4,4,19,21,11,88,22,23,23,29,69,12,24,0,88,25,11,12,2,10,28,5,6,12,25,10,22,80,10,30,80,10,22,21,69,23,22,69,61,5,9,29,2,66,11,80,8,23,3,17,88,19,0,20,21,7,10,17,17,29,20,69,8,17,21,29,2,22,84,80,71,60,21,69,11,5,8,21,25,22,88,3,0,10,25,0,10,5,8,88,2,0,27,25,21,10,31,6,25,2,16,21,82,69,35,63,11,88,4,13,29,80,22,13,29,22,88,31,3,88,3,0,10,25,0,11,80,10,30,80,23,29,19,12,8,2,10,27,17,9,11,45,95,88,57,69,16,17,19,29,80,23,29,19,0,22,4,9,1,80,3,23,5,11,28,92,69,9,5,12,12,21,69,13,30,0,0,0,0,27,4,0,28,28,28,84,80,4,22,80,0,20,21,2,25,30,17,88,21,29,8,2,0,11,3,12,23,30,69,30,31,23,88,4,13,29,80,0,22,4,12,10,21,69,11,5,8,88,31,3,88,4,13,17,3,69,11,21,23,17,21,22,88,65,69,83,80,84,87,68,69,83,80,84,87,73,69,83,80,84,87,65,83,88,91,69,29,4,6,86,92,69,15,24,12,27,24,69,28,21,21,29,30,1,11,80,10,22,80,17,16,21,69,9,5,4,28,2,4,12,5,23,29,80,10,30,80,17,16,21,69,27,25,23,27,28,0,84,80,22,23,80,17,16,17,17,88,25,3,88,4,13,29,80,17,10,5,0,88,3,16,21,80,10,30,80,17,16,25,22,88,3,0,10,25,0,11,80,12,11,80,10,26,4,4,17,30,0,28,92,69,30,2,10,21,80,12,12,80,4,12,80,10,22,19,0,88,4,13,29,80,20,13,17,1,10,17,17,13,2,0,88,31,3,88,4,13,29,80,6,17,2,6,20,21,69,30,31,9,20,31,18,11,94,69,54,17,8,29,28,28,84,80,44,88,24,4,14,21,69,30,31,16,22,20,69,12,24,4,12,80,17,16,21,69,11,5,8,88,31,3,88,4,13,17,3,69,11,21,23,17,21,22,88,25,22,88,17,69,11,25,29,12,24,69,8,17,23,12,80,10,30,80,17,16,21,69,11,1,16,25,2,0,88,31,3,88,4,13,29,80,21,29,2,12,21,21,17,29,2,69,23,22,69,12,24,0,88,19,12,10,19,9,29,80,18,16,31,22,29,80,1,17,17,8,29,4,0,10,80,12,11,80,84,67,80,10,10,80,7,1,80,21,13,4,17,17,30,2,88,4,13,29,80,22,13,29,69,23,22,69,12,24,12,11,80,22,29,2,12,29,3,69,29,1,16,25,28,69,12,31,69,11,92,69,17,4,69,16,17,22,88,4,13,29,80,23,25,4,12,23,80,22,9,2,17,80,70,76,88,29,16,20,4,12,8,28,12,29,20,69,26,9,69,11,80,17,23,80,84,88,31,3,88,4,13,29,80,21,29,2,12,21,21,17,29,2,69,12,31,69,12,24,0,88,20,12,25,29,0,12,21,23,86,80,44,88,7,12,20,28,69,11,31,10,22,80,22,16,31,18,88,4,13,25,4,69,12,24,0,88,3,16,21,80,10,30,80,17,16,25,22,88,3,0,10,25,0,11,80,17,23,80,7,29,80,4,8,0,23,23,8,12,21,17,17,29,28,28,88,65,75,78,68,81,65,67,81,72,70,83,64,68,87,74,70,81,75,70,81,67,80,4,22,20,69,30,2,10,21,80,8,13,28,17,17,0,9,1,25,11,31,80,17,16,25,22,88,30,16,21,18,0,10,80,7,1,80,22,17,8,73,88,17,11,28,80,17,16,21,11,88,4,4,19,25,11,31,80,17,16,21,69,11,1,16,25,2,0,88,2,10,23,4,73,88,4,13,29,80,11,13,29,7,29,2,69,75,94,84,76,65,80,65,66,83,77,67,80,64,73,82,65,67,87,75,72,69,17,3,69,17,30,1,29,21,1,88,0,23,23,20,16,27,21,1,84,80,18,16,25,6,16,80,0,0,0,23,29,3,22,29,3,69,12,24,0,88,0,0,10,25,8,29,4,0,10,80,10,30,80,4,88,19,12,10,19,9,29,80,18,16,31,22,29,80,1,17,17,8,29,4,0,10,80,12,11,80,84,86,80,35,23,28,9,23,7,12,22,23,69,25,23,4,17,30,69,12,24,0,88,3,4,21,21,69,11,4,0,8,3,69,26,9,69,15,24,12,27,24,69,49,80,13,25,20,69,25,2,23,17,6,0,28,80,4,12,80,17,16,25,22,88,3,16,21,92,69,49,80,13,25,6,0,88,20,12,11,19,10,14,21,23,29,20,69,12,24,4,12,80,17,16,21,69,11,5,8,88,31,3,88,4,13,29,80,22,29,2,12,29,3,69,73,80,78,88,65,74,73,70,69,83,80,84,87,72,84,88,91,69,73,95,87,77,70,69,83,80,84,87,70,87,77,80,78,88,21,17,27,94,69,25,28,22,23,80,1,29,0,0,22,20,22,88,31,11,88,4,13,29,80,20,13,17,1,10,17,17,13,2,0,88,31,3,88,4,13,29,80,6,17,2,6,20,21,75,88,62,4,21,21,9,1,92,69,12,24,0,88,3,16,21,80,10,30,80,17,16,25,22,88,29,16,20,4,12,8,28,12,29,20,69,26,9,69,65,64,69,31,25,19,29,3,69,12,24,0,88,18,12,9,5,4,28,2,4,12,21,69,80,22,10,13,2,17,16,80,21,23,7,0,10,89,69,23,22,69,12,24,0,88,19,12,10,19,16,21,22,0,10,21,11,27,21,69,23,22,69,12,24,0,88,0,0,10,25,8,29,4,0,10,80,10,30,80,4,88,19,12,10,19,9,29,80,18,16,31,22,29,80,1,17,17,8,29,4,0,10,80,12,11,80,84,86,80,36,22,20,69,26,9,69,11,25,8,17,28,4,10,80,23,29,17,22,23,30,12,22,23,69,49,80,13,25,6,0,88,28,12,19,21,18,17,3,0,88,18,0,29,30,69,25,18,9,29,80,17,23,80,1,29,4,0,10,29,12,22,21,69,12,24,0,88,3,16,21,3,69,23,22,69,12,24,0,88,3,16,26,3,0,9,5,0,22,4,69,11,21,23,17,21,22,88,25,11,88,7,13,17,19,13,88,4,13,29,80,0,0,0,10,22,21,11,12,3,69,25,2,0,88,21,19,29,30,69,22,5,8,26,21,23,11,94
|
||||
];
|
||||
|
||||
XORDecryption(cipher);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,12 +7,19 @@ forumTopicId: 302171
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The sum of the squares of the first ten natural numbers is,
|
||||
|
||||
<div style='text-align: center;'>1<sup>2</sup> + 2<sup>2</sup> + ... + 10<sup>2</sup> = 385</div>
|
||||
|
||||
The square of the sum of the first ten natural numbers is,
|
||||
|
||||
<div style='text-align: center;'>(1 + 2 + ... + 10)<sup>2</sup> = 55<sup>2</sup> = 3025</div>
|
||||
|
||||
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
|
||||
Find the difference between the sum of the squares of the first <code>n</code> natural numbers and the square of the sum.
|
||||
|
||||
Find the difference between the sum of the squares of the first `n` natural numbers and the square of the sum.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,6 +32,8 @@ Find the difference between the sum of the squares of the first <code>n</code> n
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>sumSquareDifference(10)</code> should return a number.
|
||||
testString: assert(typeof sumSquareDifference(10) === 'number');
|
||||
- text: <code>sumSquareDifference(10)</code> should return 2640.
|
||||
testString: assert.strictEqual(sumSquareDifference(10), 2640);
|
||||
- text: <code>sumSquareDifference(20)</code> should return 41230.
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302172
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
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.
|
||||
|
||||
Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,8 +24,10 @@ Find the lowest sum for a set of five primes for which any two primes concatenat
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler60()</code> should return 26033.
|
||||
testString: assert.strictEqual(euler60(), 26033);
|
||||
- text: <code>primePairSets()</code> should return a number.
|
||||
testString: assert(typeof primePairSets() === 'number');
|
||||
- text: <code>primePairSets()</code> should return 26033.
|
||||
testString: assert.strictEqual(primePairSets(), 26033);
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +39,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler60() {
|
||||
function primePairSets() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler60();
|
||||
primePairSets();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -19,10 +19,15 @@ Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are a
|
||||
|Octagonal|P<sub>8</sub>,<var><sub>n</sub></var>=<var>n</var>(3<var>n</var>−2)|1, 8, 21, 40, 65, ...|
|
||||
|
||||
The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.
|
||||
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).
|
||||
Each polygonal type: triangle (P3,127=8128), square (P4,91=8281), and pentagonal (P5,44=2882), is represented by a different number in the set.
|
||||
This is the only set of 4-digit numbers with this property.
|
||||
|
||||
<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>
|
||||
|
||||
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.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -35,8 +40,10 @@ Find the sum of the only ordered set of six cyclic 4-digit numbers for which eac
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler61()</code> should return 28684.
|
||||
testString: assert.strictEqual(euler61(), 28684);
|
||||
- text: <code>cyclicalFigurateNums()</code> should return a number.
|
||||
testString: assert(typeof cyclicalFigurateNums() === 'number');
|
||||
- text: <code>cyclicalFigurateNums()</code> should return 28684.
|
||||
testString: assert.strictEqual(cyclicalFigurateNums(), 28684);
|
||||
|
||||
```
|
||||
|
||||
@ -48,12 +55,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler61() {
|
||||
function cyclicalFigurateNums() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler61();
|
||||
cyclicalFigurateNums();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302174
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.
|
||||
|
||||
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.
|
||||
|
||||
Find the smallest cube for which exactly five permutations of its digits are cube.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,8 +24,10 @@ Find the smallest cube for which exactly five permutations of its digits are cub
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler62()</code> should return 127035954683.
|
||||
testString: assert.strictEqual(euler62(), 127035954683);
|
||||
- text: <code>cubicPermutations()</code> should return a number.
|
||||
testString: assert(typeof cubicPermutations() === 'number');
|
||||
- text: <code>cubicPermutations()</code> should return 127035954683.
|
||||
testString: assert.strictEqual(cubicPermutations(), 127035954683);
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +39,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler62() {
|
||||
function cubicPermutations() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler62();
|
||||
cubicPermutations();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302175
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power.
|
||||
How many n-digit positive integers exist which are also an nth power?
|
||||
|
||||
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.
|
||||
|
||||
How many <var>n</var>-digit positive integers exist which are also an <var>n</var>th power?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,8 +24,10 @@ How many n-digit positive integers exist which are also an nth power?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler63()</code> should return 49.
|
||||
testString: assert.strictEqual(euler63(), 49);
|
||||
- text: <code>powerfulDigitCounts()</code> should return a number.
|
||||
testString: assert(typeof powerfulDigitCounts() === 'number');
|
||||
- text: <code>powerfulDigitCounts()</code> should return 49.
|
||||
testString: assert.strictEqual(powerfulDigitCounts(), 49);
|
||||
|
||||
```
|
||||
|
||||
@ -34,12 +39,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler63() {
|
||||
function powerfulDigitCounts() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler63();
|
||||
powerfulDigitCounts();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,130 +7,65 @@ forumTopicId: 302176
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
All square roots are periodic when written as continued fractions and can be written in the form:
|
||||
|
||||
√N = a0 +
|
||||
1
|
||||
$\displaystyle \quad \quad \sqrt{N}=a_0+\frac 1 {a_1+\frac 1 {a_2+ \frac 1 {a3+ \dots}}}$
|
||||
|
||||
a1 +
|
||||
1
|
||||
For example, let us consider $\sqrt{23}:$:
|
||||
|
||||
|
||||
a2 +
|
||||
1
|
||||
|
||||
|
||||
|
||||
a3 + ...
|
||||
|
||||
For example, let us consider √23:
|
||||
|
||||
√23 = 4 + √23 — 4 = 4 +
|
||||
1
|
||||
= 4 +
|
||||
1
|
||||
|
||||
1√23—4
|
||||
|
||||
1 +
|
||||
√23 – 37
|
||||
$\quad \quad \sqrt{23}=4+\sqrt{23}-4=4+\frac 1 {\frac 1 {\sqrt{23}-4}}=4+\frac 1 {1+\frac{\sqrt{23}-3}7}$
|
||||
|
||||
If we continue we would get the following expansion:
|
||||
|
||||
√23 = 4 +
|
||||
1
|
||||
$\displaystyle \quad \quad \sqrt{23}=4+\frac 1 {1+\frac 1 {3+ \frac 1 {1+\frac 1 {8+ \dots}}}}$
|
||||
|
||||
1 +
|
||||
1
|
||||
The process can be summarized as follows:
|
||||
|
||||
$\quad \quad a_0=4, \frac 1 {\sqrt{23}-4}=\frac {\sqrt{23}+4} 7=1+\frac {\sqrt{23}-3} 7$
|
||||
|
||||
3 +
|
||||
1
|
||||
$\quad \quad a_1=1, \frac 7 {\sqrt{23}-3}=\frac {7(\sqrt{23}+3)} {14}=3+\frac {\sqrt{23}-3} 2$
|
||||
|
||||
$\quad \quad a_2=3, \frac 2 {\sqrt{23}-3}=\frac {2(\sqrt{23}+3)} {14}=1+\frac {\sqrt{23}-4} 7$
|
||||
|
||||
$\quad \quad a_3=1, \frac 7 {\sqrt{23}-4}=\frac {7(\sqrt{23}+4)} 7=8+\sqrt{23}-4$
|
||||
|
||||
1 +
|
||||
1
|
||||
$\quad \quad a_4=8, \frac 1 {\sqrt{23}-4}=\frac {\sqrt{23}+4} 7=1+\frac {\sqrt{23}-3} 7$
|
||||
|
||||
$\quad \quad a_5=1, \frac 7 {\sqrt{23}-3}=\frac {7 (\sqrt{23}+3)} {14}=3+\frac {\sqrt{23}-3} 2$
|
||||
|
||||
$\quad \quad a_6=3, \frac 2 {\sqrt{23}-3}=\frac {2(\sqrt{23}+3)} {14}=1+\frac {\sqrt{23}-4} 7$
|
||||
|
||||
$\quad \quad a_7=1, \frac 7 {\sqrt{23}-4}=\frac {7(\sqrt{23}+4)} {7}=8+\sqrt{23}-4$
|
||||
|
||||
8 + ...
|
||||
|
||||
The process can be summarised as follows:
|
||||
|
||||
a0 = 4,
|
||||
|
||||
1√23—4
|
||||
=
|
||||
√23+47
|
||||
= 1 +
|
||||
√23—37
|
||||
a1 = 1,
|
||||
|
||||
7√23—3
|
||||
=
|
||||
7(√23+3)14
|
||||
= 3 +
|
||||
√23—32
|
||||
a2 = 3,
|
||||
|
||||
2√23—3
|
||||
=
|
||||
2(√23+3)14
|
||||
= 1 +
|
||||
√23—47
|
||||
a3 = 1,
|
||||
|
||||
7√23—4
|
||||
=
|
||||
7(√23+4)7
|
||||
= 8 +
|
||||
√23—4
|
||||
a4 = 8,
|
||||
|
||||
1√23—4
|
||||
=
|
||||
√23+47
|
||||
= 1 +
|
||||
√23—37
|
||||
a5 = 1,
|
||||
|
||||
7√23—3
|
||||
=
|
||||
7(√23+3)14
|
||||
= 3 +
|
||||
√23—32
|
||||
a6 = 3,
|
||||
|
||||
2√23—3
|
||||
=
|
||||
2(√23+3)14
|
||||
= 1 +
|
||||
√23—47
|
||||
a7 = 1,
|
||||
|
||||
7√23—4
|
||||
=
|
||||
7(√23+4)7
|
||||
= 8 +
|
||||
√23—4
|
||||
|
||||
It can be seen that the sequence is repeating. For conciseness, we use the notation √23 = [4;(1,3,1,8)], to indicate that the block (1,3,1,8) repeats indefinitely.
|
||||
It can be seen that the sequence is repeating. For conciseness, we use the notation $\sqrt{23}=[4;(1,3,1,8)]$, to indicate that the block (1,3,1,8) repeats indefinitely.
|
||||
|
||||
The first ten continued fraction representations of (irrational) square roots are:
|
||||
√2=[1;(2)], period=1
|
||||
√3=[1;(1,2)], period=2
|
||||
√5=[2;(4)], period=1
|
||||
√6=[2;(2,4)], period=2
|
||||
√7=[2;(1,1,1,4)], period=4
|
||||
√8=[2;(1,4)], period=2
|
||||
√10=[3;(6)], period=1
|
||||
√11=[3;(3,6)], period=2
|
||||
√12= [3;(2,6)], period=2
|
||||
√13=[3;(1,1,1,1,6)], period=5
|
||||
Exactly four continued fractions, for N ≤ 13, have an odd period.
|
||||
How many continued fractions for N ≤ 10000 have an odd period?
|
||||
|
||||
$\quad \quad \sqrt{2}=[1;(2)]$, period = 1
|
||||
|
||||
$\quad \quad \sqrt{3}=[1;(1,2)]$, period = 2
|
||||
|
||||
$\quad \quad \sqrt{5}=[2;(4)]$, period = 1
|
||||
|
||||
$\quad \quad \sqrt{6}=[2;(2,4)]$, period = 2
|
||||
|
||||
$\quad \quad \sqrt{7}=[2;(1,1,1,4)]$, period = 4
|
||||
|
||||
$\quad \quad \sqrt{8}=[2;(1,4)]$, period = 2
|
||||
|
||||
$\quad \quad \sqrt{10}=[3;(6)]$, period = 1
|
||||
|
||||
$\quad \quad \sqrt{11}=[3;(3,6)]$, period = 2
|
||||
|
||||
$\quad \quad \sqrt{12}=[3;(2,6)]$, period = 2
|
||||
|
||||
$\quad \quad \sqrt{13}=[3;(1,1,1,1,6)]$, period = 5
|
||||
|
||||
Exactly four continued fractions, for $N \le 13$, have an odd period.
|
||||
|
||||
How many continued fractions for $N \le 10\,000$ have an odd period?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -143,8 +78,10 @@ How many continued fractions for N ≤ 10000 have an odd period?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler64()</code> should return 1322.
|
||||
testString: assert.strictEqual(euler64(), 1322);
|
||||
- text: <code>oddPeriodSqrts()</code> should return a number.
|
||||
testString: assert(typeof oddPeriodSqrts() === 'number');
|
||||
- text: <code>oddPeriodSqrts()</code> should return 1322.
|
||||
testString: assert.strictEqual(oddPeriodSqrts(), 1322);
|
||||
|
||||
```
|
||||
|
||||
@ -156,12 +93,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler64() {
|
||||
function oddPeriodSqrts() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler64();
|
||||
oddPeriodSqrts();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,96 +7,32 @@ forumTopicId: 302177
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The square root of 2 can be written as an infinite continued fraction.
|
||||
|
||||
√2 = 1 +
|
||||
1
|
||||
$\sqrt{2} = 1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + ...}}}}$
|
||||
|
||||
2 +
|
||||
1
|
||||
The infinite continued fraction can be written, $\sqrt{2} = [1; (2)]$ indicates that 2 repeats <i>ad infinitum</i>. In a similar way, $\sqrt{23} = [4; (1, 3, 1, 8)]$.
|
||||
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for $\sqrt{2}$.
|
||||
|
||||
$1 + \dfrac{1}{2} = \dfrac{3}{2}\\\\
|
||||
1 + \dfrac{1}{2 + \dfrac{1}{2}} = \dfrac{7}{5}\\\\
|
||||
1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}} = \dfrac{17}{12}\\\\
|
||||
1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}}} = \dfrac{41}{29}$
|
||||
|
||||
2 +
|
||||
1
|
||||
Hence the sequence of the first ten convergents for $\sqrt{2}$ are:
|
||||
|
||||
$1, \dfrac{3}{2}, \dfrac{7}{5}, \dfrac{17}{12}, \dfrac{41}{29}, \dfrac{99}{70}, \dfrac{239}{169}, \dfrac{577}{408}, \dfrac{1393}{985}, \dfrac{3363}{2378}, ...$
|
||||
|
||||
What is most surprising is that the important mathematical constant, $e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, ... , 1, 2k, 1, ...]$.
|
||||
The first ten terms in the sequence of convergents for <var>e</var> are:
|
||||
|
||||
2 +
|
||||
1
|
||||
$2, 3, \dfrac{8}{3}, \dfrac{11}{4}, \dfrac{19}{7}, \dfrac{87}{32}, \dfrac{106}{39}, \dfrac{193}{71}, \dfrac{1264}{465}, \dfrac{1457}{536}, ...$
|
||||
|
||||
The sum of digits in the numerator of the 10<sup>th</sup> convergent is $1 + 4 + 5 + 7 = 17$.
|
||||
|
||||
Find the sum of digits in the numerator of the 100<sup>th</sup> convergent of the continued fraction for <var>e</var>.
|
||||
|
||||
|
||||
2 + ...
|
||||
|
||||
The infinite continued fraction can be written, √2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, √23 = [4;(1,3,1,8)].
|
||||
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for √2.
|
||||
|
||||
|
||||
1 +
|
||||
1
|
||||
= 3/2
|
||||
|
||||
2
|
||||
|
||||
1 +
|
||||
1
|
||||
= 7/5
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
2
|
||||
|
||||
1 +
|
||||
1
|
||||
= 17/12
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
|
||||
|
||||
2
|
||||
|
||||
1 +
|
||||
1
|
||||
= 41/29
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
|
||||
|
||||
2 +
|
||||
1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
|
||||
|
||||
|
||||
Hence the sequence of the first ten convergents for √2 are:
|
||||
1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, ...
|
||||
What is most surprising is that the important mathematical constant,e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].
|
||||
The first ten terms in the sequence of convergents for e are:
|
||||
2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...
|
||||
The sum of digits in the numerator of the 10th convergent is 1+4+5+7=17.
|
||||
Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -109,8 +45,10 @@ Find the sum of digits in the numerator of the 100th convergent of the continued
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler65()</code> should return 272.
|
||||
testString: assert.strictEqual(euler65(), 272);
|
||||
- text: <code>convergentsOfE()</code> should return a number.
|
||||
testString: assert(typeof convergentsOfE() === 'number');
|
||||
- text: <code>convergentsOfE()</code> should return 272.
|
||||
testString: assert.strictEqual(convergentsOfE(), 272);
|
||||
|
||||
```
|
||||
|
||||
@ -122,12 +60,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler65() {
|
||||
function convergentsOfE() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler65();
|
||||
convergentsOfE();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,17 +7,29 @@ forumTopicId: 302178
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Consider quadratic Diophantine equations of the form:
|
||||
x2 – Dy2 = 1
|
||||
For example, when D=13, the minimal solution in x is 6492 – 13×1802 = 1.
|
||||
|
||||
<div style='text-align: center;'>x<sup>2</sup> – Dy<sup>2</sup> = 1</div>
|
||||
|
||||
For example, when D=13, the minimal solution in x is 649<sup>2</sup> – 13×180<sup>2</sup> = 1.
|
||||
|
||||
It can be assumed that there are no solutions in positive integers when D is square.
|
||||
|
||||
By finding minimal solutions in x for D = {2, 3, 5, 6, 7}, we obtain the following:
|
||||
32 – 2×22 = 1
|
||||
22 – 3×12 = 192 – 5×42 = 1
|
||||
52 – 6×22 = 1
|
||||
82 – 7×32 = 1
|
||||
Hence, by considering minimal solutions in x for D ≤ 7, the largest x is obtained when D=5.
|
||||
Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.
|
||||
|
||||
<div style='margin-left: 2em;'>
|
||||
3<sup>2</sup> – 2×2<sup>2</sup> = 1<br>
|
||||
2<sup>2</sup> – 3×1<sup>2</sup> = 1<br>
|
||||
<strong><span style='color: red;'>9</span></strong><sup>2</sup> – 5×4<sup>2</sup> = 1<br>
|
||||
5<sup>2</sup> – 6×2<sup>2</sup> = 1<br>
|
||||
8<sup>2</sup> – 7×3<sup>2</sup> = 1<br>
|
||||
</div>
|
||||
|
||||
Hence, by considering minimal solutions in <var>x</var> for D ≤ 7, the largest <var>x</var> is obtained when D=5.
|
||||
|
||||
Find the value of D ≤ 1000 in minimal solutions of <var>x</var> for which the largest value of <var>x</var> is obtained.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -30,8 +42,10 @@ Find the value of D ≤ 1000 in minimal solutions of x for which the largest val
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler66()</code> should return 661.
|
||||
testString: assert.strictEqual(euler66(), 661);
|
||||
- text: <code>diophantineEquation()</code> should return a number.
|
||||
testString: assert(typeof diophantineEquation() === 'number');
|
||||
- text: <code>diophantineEquation()</code> should return 661.
|
||||
testString: assert.strictEqual(diophantineEquation(), 661);
|
||||
|
||||
```
|
||||
|
||||
@ -43,12 +57,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler66() {
|
||||
function diophantineEquation() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler66();
|
||||
diophantineEquation();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -7,10 +7,13 @@ forumTopicId: 302180
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.
|
||||
|
||||
<img class="img-responsive center-block" alt="a completed example of a 3-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/3-gon-ring.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
Working <strong>clockwise</strong>, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.
|
||||
|
||||
Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.
|
||||
It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total.
|
||||
|
||||
<div style='text-align: center;'>
|
||||
@ -29,7 +32,11 @@ It is possible to complete the ring with four different totals: 9, 10, 11, and 1
|
||||
</div>
|
||||
|
||||
By concatenating each group it is possible to form 9-digit strings; the maximum string for a 3-gon ring is 432621513.
|
||||
Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum 16-digit string for a "magic" 5-gon ring?
|
||||
|
||||
Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum <strong>16-digit</strong> string for a "magic" 5-gon ring?
|
||||
|
||||
<img class="img-responsive center-block" alt="a blank diagram of a 5-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/5-gon-ring.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -42,8 +49,10 @@ Using the numbers 1 to 10, and depending on arrangements, it is possible to form
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler68()</code> should return 6531031914842725.
|
||||
testString: assert.strictEqual(euler68(), 6531031914842725);
|
||||
- text: <code>magic5GonRing()</code> should return a number.
|
||||
testString: assert(typeof magic5GonRing() === 'number');
|
||||
- text: <code>magic5GonRing()</code> should return 6531031914842725.
|
||||
testString: assert.strictEqual(magic5GonRing(), 6531031914842725);
|
||||
|
||||
```
|
||||
|
||||
@ -55,12 +64,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler68() {
|
||||
function magic5GonRing() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler68();
|
||||
magic5GonRing();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -42,8 +42,10 @@ Find the value of <var>n</var> ≤ 1,000,000 for which n/φ(<var>n</var>) is a m
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler69()</code> should return 510510.
|
||||
testString: assert.strictEqual(euler69(), 510510);
|
||||
- text: <code>totientMaximum()</code> should return a number.
|
||||
testString: assert(typeof totientMaximum() === 'number');
|
||||
- text: <code>totientMaximum()</code> should return 510510.
|
||||
testString: assert.strictEqual(totientMaximum(), 510510);
|
||||
|
||||
```
|
||||
|
||||
@ -55,12 +57,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler69() {
|
||||
function totientMaximum() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler69();
|
||||
totientMaximum();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,8 +7,11 @@ forumTopicId: 302182
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
|
||||
What is the <code>n</code>th prime number?
|
||||
|
||||
What is the `n`th prime number?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -21,6 +24,8 @@ What is the <code>n</code>th prime number?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>nthPrime(6)</code> should return a number.
|
||||
testString: assert(typeof nthPrime(6) === 'number');
|
||||
- text: <code>nthPrime(6)</code> should return 13.
|
||||
testString: assert.strictEqual(nthPrime(6), 13);
|
||||
- text: <code>nthPrime(10)</code> should return 29.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302183
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.The number 1 is considered to be relatively prime to every positive number, so φ(1)=1.
|
||||
|
||||
Euler's Totient function, φ(<var>n</var>) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to <var>n</var> which are relatively prime to <var>n</var>. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6. The number 1 is considered to be relatively prime to every positive number, so φ(1)=1.
|
||||
|
||||
Interestingly, φ(87109)=79180, and it can be seen that 87109 is a permutation of 79180.
|
||||
Find the value of n, 1 < n < 107, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.
|
||||
|
||||
Find the value of <var>n</var>, 1 < <var>n</var> < 107, for which φ(<var>n</var>) is a permutation of <var>n</var> and the ratio <var>n</var>/φ(<var>n</var>) produces a minimum.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ Find the value of n, 1 < n < 107, for which φ(n) is a permutation of n and the
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler70()</code> should return 8319823.
|
||||
testString: assert.strictEqual(euler70(), 8319823);
|
||||
- text: <code>totientPermutation()</code> should return a number.
|
||||
testString: assert(typeof totientPermutation() === 'number');
|
||||
- text: <code>totientPermutation()</code> should return 8319823.
|
||||
testString: assert.strictEqual(totientPermutation(), 8319823);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler70() {
|
||||
function totientPermutation() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler70();
|
||||
totientPermutation();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302184
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction.
|
||||
If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get:
|
||||
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8
|
||||
|
||||
Consider the fraction, <var>n</var>/<var>d</var>, where <var>n</var> and <var>d</var> are positive integers. If <var>n</var><<var>d</var> and HCF(<var>n</var>,<var>d</var>)=1, it is called a reduced proper fraction.
|
||||
|
||||
If we list the set of reduced proper fractions for <var>d</var> ≤ 8 in ascending order of size, we get:
|
||||
|
||||
<div style='text-align: center;'>1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, <strong>2/5</strong>, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8</div>
|
||||
|
||||
It can be seen that 2/5 is the fraction immediately to the left of 3/7.
|
||||
By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending order of size, find the numerator of the fraction immediately to the left of 3/7.
|
||||
|
||||
By listing the set of reduced proper fractions for <var>d</var> ≤ 1,000,000 in ascending order of size, find the numerator of the fraction immediately to the left of 3/7.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,8 +30,10 @@ By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler71()</code> should return 428570.
|
||||
testString: assert.strictEqual(euler71(), 428570);
|
||||
- text: <code>orderedFractions()</code> should return a number.
|
||||
testString: assert(typeof orderedFractions() === 'number');
|
||||
- text: <code>orderedFractions()</code> should return 428570.
|
||||
testString: assert.strictEqual(orderedFractions(), 428570);
|
||||
|
||||
```
|
||||
|
||||
@ -37,12 +45,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler71() {
|
||||
function orderedFractions() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler71();
|
||||
orderedFractions();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302185
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction.
|
||||
If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get:
|
||||
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8
|
||||
|
||||
Consider the fraction, <var>n</var>/<var>d</var>, where n and d are positive integers. If <var>n</var><<var>d</var> and HCF(<var>n</var>,<var>d</var>)=1, it is called a reduced proper fraction.
|
||||
|
||||
If we list the set of reduced proper fractions for <var>d</var> ≤ 8 in ascending order of size, we get:
|
||||
|
||||
<div style='text-align: center;'>1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8</div>
|
||||
|
||||
It can be seen that there are 21 elements in this set.
|
||||
How many elements would be contained in the set of reduced proper fractions for d ≤ 1,000,000?
|
||||
|
||||
How many elements would be contained in the set of reduced proper fractions for <var>d</var> ≤ 1,000,000?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,8 +30,10 @@ How many elements would be contained in the set of reduced proper fractions for
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler72()</code> should return 303963552391.
|
||||
testString: assert.strictEqual(euler72(), 303963552391);
|
||||
- text: <code>countingFractions()</code> should return a number.
|
||||
testString: assert(typeof countingFractions() === 'number');
|
||||
- text: <code>countingFractions()</code> should return 303963552391.
|
||||
testString: assert.strictEqual(countingFractions(), 303963552391);
|
||||
|
||||
```
|
||||
|
||||
@ -37,12 +45,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler72() {
|
||||
function countingFractions() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler72();
|
||||
countingFractions();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,11 +7,17 @@ forumTopicId: 302186
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1, it is called a reduced proper fraction.
|
||||
If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size, we get:
|
||||
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8
|
||||
|
||||
Consider the fraction, <var>n</var>/<var>d</var>, where n and d are positive integers. If <var>n</var><<var>d</var> and HCF(<var>n</var>,<var>d</var>)=1, it is called a reduced proper fraction.
|
||||
|
||||
If we list the set of reduced proper fractions for <var>d</var> ≤ 8 in ascending order of size, we get:
|
||||
|
||||
<div style='text-align: center;'>1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, <strong>3/8</strong>, <strong>2/5</strong>, <strong>3/7</strong>, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8</div>
|
||||
|
||||
It can be seen that there are 3 fractions between 1/3 and 1/2.
|
||||
How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper fractions for d ≤ 12,000?
|
||||
|
||||
How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper fractions for <var>d</var> ≤ 12,000?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,8 +30,10 @@ How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper f
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler73()</code> should return 7295372.
|
||||
testString: assert.strictEqual(euler73(), 7295372);
|
||||
- text: <code>countingFractionsInARange()</code> should return a number.
|
||||
testString: assert(typeof countingFractionsInARange() === 'number');
|
||||
- text: <code>countingFractionsInARange()</code> should return 7295372.
|
||||
testString: assert.strictEqual(countingFractionsInARange(), 7295372);
|
||||
|
||||
```
|
||||
|
||||
@ -37,12 +45,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler73() {
|
||||
function countingFractionsInARange() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler73();
|
||||
countingFractionsInARange();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,18 +7,30 @@ forumTopicId: 302187
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The number 145 is well known for the property that the sum of the factorial of its digits is equal to 145:
|
||||
1! + 4! + 5! = 1 + 24 + 120 = 145
|
||||
|
||||
<div style='margin-left: 4em;'>1! + 4! + 5! = 1 + 24 + 120 = 145</div>
|
||||
|
||||
Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it turns out that there are only three such loops that exist:
|
||||
169 → 363601 → 1454 → 169
|
||||
871 → 45361 → 871
|
||||
872 → 45362 → 872
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
169 → 363601 → 1454 → 169<br>
|
||||
871 → 45361 → 871<br>
|
||||
872 → 45362 → 872<br>
|
||||
</div>
|
||||
It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example,
|
||||
69 → 363600 → 1454 → 169 → 363601 (→ 1454)
|
||||
78 → 45360 → 871 → 45361 (→ 871)
|
||||
540 → 145 (→ 145)
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
69 → 363600 → 1454 → 169 → 363601 (→ 1454)<br>
|
||||
78 → 45360 → 871 → 45361 (→ 871)<br>
|
||||
540 → 145 (→ 145)<br>
|
||||
</div>
|
||||
|
||||
Starting with 69 produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms.
|
||||
|
||||
How many chains, with a starting number below one million, contain exactly sixty non-repeating terms?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -31,8 +43,10 @@ How many chains, with a starting number below one million, contain exactly sixty
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler74()</code> should return 402.
|
||||
testString: assert.strictEqual(euler74(), 402);
|
||||
- text: <code>digitFactorialChains()</code> should return a number.
|
||||
testString: assert(typeof digitFactorialChains() === 'number');
|
||||
- text: <code>digitFactorialChains()</code> should return 402.
|
||||
testString: assert.strictEqual(digitFactorialChains(), 402);
|
||||
|
||||
```
|
||||
|
||||
@ -44,12 +58,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler74() {
|
||||
function digitFactorialChains() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler74();
|
||||
digitFactorialChains();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,11 +7,26 @@ forumTopicId: 302188
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.
|
||||
12 cm: (3,4,5)24 cm: (6,8,10)30 cm: (5,12,13)36 cm: (9,12,15)40 cm: (8,15,17)48 cm: (12,16,20)
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
<strong>12 cm:</strong> (3,4,5)<br>
|
||||
<strong>24 cm:</strong> (6,8,10)<br>
|
||||
<strong>30 cm:</strong> (5,12,13)<br>
|
||||
<strong>36 cm:</strong> (9,12,15)<br>
|
||||
<strong>40 cm:</strong> (8,15,17)<br>
|
||||
<strong>48 cm:</strong> (12,16,20)<br>
|
||||
</div>
|
||||
|
||||
In contrast, some lengths of wire, like 20 cm, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using 120 cm it is possible to form exactly three different integer sided right angle triangles.
|
||||
120 cm: (30,40,50), (20,48,52), (24,45,51)
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
<strong>120 cm:</strong> (30,40,50), (20,48,52), (24,45,51)
|
||||
</div>
|
||||
|
||||
Given that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right angle triangle be formed?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -24,8 +39,10 @@ Given that L is the length of the wire, for how many values of L ≤ 1,500,000 c
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler75()</code> should return 161667.
|
||||
testString: assert.strictEqual(euler75(), 161667);
|
||||
- text: <code>singularIntRightTriangles()</code> should return a number.
|
||||
testString: assert(typeof singularIntRightTriangles() === 'number');
|
||||
- text: <code>singularIntRightTriangles()</code> should return 161667.
|
||||
testString: assert.strictEqual(singularIntRightTriangles(), 161667);
|
||||
|
||||
```
|
||||
|
||||
@ -37,12 +54,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler75() {
|
||||
function singularIntRightTriangles() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler75();
|
||||
singularIntRightTriangles();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,14 +7,20 @@ forumTopicId: 302189
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It is possible to write five as a sum in exactly six different ways:
|
||||
4 + 1
|
||||
3 + 2
|
||||
3 + 1 + 1
|
||||
2 + 2 + 1
|
||||
2 + 1 + 1 + 1
|
||||
1 + 1 + 1 + 1 + 1
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
4 + 1<br>
|
||||
3 + 2<br>
|
||||
3 + 1 + 1<br>
|
||||
2 + 2 + 1<br>
|
||||
2 + 1 + 1 + 1<br>
|
||||
1 + 1 + 1 + 1 + 1<br>
|
||||
</div>
|
||||
|
||||
How many different ways can one hundred be written as a sum of at least two positive integers?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -27,8 +33,10 @@ How many different ways can one hundred be written as a sum of at least two posi
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler76()</code> should return 190569291.
|
||||
testString: assert.strictEqual(euler76(), 190569291);
|
||||
- text: <code>countingSummations()</code> should return a number.
|
||||
testString: assert(typeof countingSummations() === 'number');
|
||||
- text: <code>countingSummations()</code> should return 190569291.
|
||||
testString: assert.strictEqual(countingSummations(), 190569291);
|
||||
|
||||
```
|
||||
|
||||
@ -40,12 +48,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler76() {
|
||||
function countingSummations() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler76();
|
||||
countingSummations();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,13 +7,19 @@ forumTopicId: 302190
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It is possible to write ten as the sum of primes in exactly five different ways:
|
||||
7 + 3
|
||||
5 + 5
|
||||
5 + 3 + 2
|
||||
3 + 3 + 2 + 2
|
||||
2 + 2 + 2 + 2 + 2
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
7 + 3<br>
|
||||
5 + 5<br>
|
||||
5 + 3 + 2<br>
|
||||
3 + 3 + 2 + 2<br>
|
||||
2 + 2 + 2 + 2 + 2<br>
|
||||
</div>
|
||||
|
||||
What is the first value which can be written as the sum of primes in over five thousand different ways?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -26,8 +32,10 @@ What is the first value which can be written as the sum of primes in over five t
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler77()</code> should return 71.
|
||||
testString: assert.strictEqual(euler77(), 71);
|
||||
- text: <code>primeSummations()</code> should return a number.
|
||||
testString: assert(typeof primeSummations() === 'number');
|
||||
- text: <code>primeSummations()</code> should return 71.
|
||||
testString: assert.strictEqual(primeSummations(), 71);
|
||||
|
||||
```
|
||||
|
||||
@ -39,12 +47,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler77() {
|
||||
function primeSummations() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler77();
|
||||
primeSummations();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,6 +7,7 @@ forumTopicId: 302191
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so p(5)=7.
|
||||
|
||||
<div style='text-align: center;'>
|
||||
@ -25,7 +26,6 @@ Let p(n) represent the number of different ways in which n coins can be separate
|
||||
|
||||
Find the least value of <var>n</var> for which p(<var>n</var>) is divisible by one million.
|
||||
|
||||
Find the least value of n for which p(n) is divisible by one million.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -38,8 +38,10 @@ Find the least value of n for which p(n) is divisible by one million.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler78()</code> should return 55374.
|
||||
testString: assert.strictEqual(euler78(), 55374);
|
||||
- text: <code>coinPartitions()</code> should return a number.
|
||||
testString: assert(typeof coinPartitions() === 'number');
|
||||
- text: <code>coinPartitions()</code> should return 55374.
|
||||
testString: assert.strictEqual(coinPartitions(), 55374);
|
||||
|
||||
```
|
||||
|
||||
@ -51,12 +53,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler78() {
|
||||
function coinPartitions() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler78();
|
||||
coinPartitions();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302192
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
|
||||
The text file, keylog.txt, contains fifty successful login attempts.
|
||||
Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length.
|
||||
|
||||
The array, `keylog`, contains fifty successful login attempts.
|
||||
|
||||
Given that the three characters are always asked for in order, analyze the array so as to determine the shortest possible secret passcode of unknown length.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ Given that the three characters are always asked for in order, analyse the file
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler79()</code> should return 73162890.
|
||||
testString: assert.strictEqual(euler79(), 73162890);
|
||||
- text: <code>passcodeDerivation(keylog)</code> should return a number.
|
||||
testString: assert(typeof passcodeDerivation(keylog) === 'number');
|
||||
- text: <code>passcodeDerivation(keylog)</code> should return 73162890.
|
||||
testString: assert.strictEqual(passcodeDerivation(keylog), 73162890);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,18 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler79() {
|
||||
function passcodeDerivation(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler79();
|
||||
// Only change code above this line
|
||||
|
||||
const keylog = [
|
||||
319,680,180,690,129,620,762,689,762,318,368,710,720,710,629,168,160,689,716,731,736,729,316,729,729,710,769,290,719,680,318,389,162,289,162,718,729,319,790,680,890,362,319,760,316,729,380,319,728,716,
|
||||
];
|
||||
|
||||
passcodeDerivation(keylog);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,6 +7,7 @@ forumTopicId: 302193
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
|
||||
|
||||
<div style='text-align: center;'>73167176531330624919225119674426574742355349194934</div>
|
||||
@ -29,7 +30,9 @@ The four adjacent digits in the 1000-digit number that have the greatest product
|
||||
<div style='text-align: center;'>84580156166097919133875499200524063689912560717606</div>
|
||||
<div style='text-align: center;'>05886116467109405077541002256983155200055935729725</div>
|
||||
<div style='text-align: center;'>71636269561882670428252483600823257530420752963450</div>
|
||||
Find the <code>n</code> adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
|
||||
|
||||
Find the `n` adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -42,6 +45,8 @@ Find the <code>n</code> adjacent digits in the 1000-digit number that have the g
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>largestProductinaSeries(4)</code> should return a number.
|
||||
testString: assert(typeof largestProductinaSeries(4) === 'number');
|
||||
- text: <code>largestProductinaSeries(4)</code> should return 5832.
|
||||
testString: assert.strictEqual(largestProductinaSeries(4), 5832);
|
||||
- text: <code>largestProductinaSeries(13)</code> should return 23514624000.
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302194
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.
|
||||
|
||||
The square root of two is 1.41421356237309504880..., and the digital sum of the first one hundred decimal digits is 475.
|
||||
|
||||
For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ For the first one hundred natural numbers, find the total of the digital sums of
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler80()</code> should return 40886.
|
||||
testString: assert.strictEqual(euler80(), 40886);
|
||||
- text: <code>sqrtDigitalExpansion()</code> should return a number.
|
||||
testString: assert(typeof sqrtDigitalExpansion() === 'number');
|
||||
- text: <code>sqrtDigitalExpansion()</code> should return 40886.
|
||||
testString: assert.strictEqual(sqrtDigitalExpansion(), 40886);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler80() {
|
||||
function sqrtDigitalExpansion() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler80();
|
||||
sqrtDigitalExpansion();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,19 +7,21 @@ forumTopicId: 302195
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by only moving to the right and down, is indicated in bold red and is equal to 2427.
|
||||
|
||||
$$
|
||||
\begin{pmatrix}
|
||||
\color{red}{131} & 673 & 234 & 103 & 18\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\
|
||||
630 & 803 & \color{red}{746} & \color{red}{422} & 111\\
|
||||
537 & 699 & 497 & \color{red}{121} & 956\\
|
||||
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
|
||||
\end{pmatrix}
|
||||
$$
|
||||
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by <strong>only moving to the right and down</strong>, is indicated in bold red and is equal to 2427.
|
||||
|
||||
<div style='text-align: center;'>
|
||||
$\begin{pmatrix}
|
||||
\color{red}{131} & 673 & 234 & 103 & 18\\\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\
|
||||
630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\
|
||||
537 & 699 & 497 & \color{red}{121} & 956\\\\
|
||||
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
|
||||
\end{pmatrix}$
|
||||
</div>
|
||||
|
||||
Find the minimal path sum from the top left to the bottom right by only moving right and down in `matrix`, a 2D array containing an 80 by 80 matrix.
|
||||
|
||||
Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..."), a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right by only moving right and down.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -32,8 +34,12 @@ Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler81()</code> should return 427337.
|
||||
testString: assert.strictEqual(euler81(), 427337);
|
||||
- text: <code>pathSumTwoWays(testMatrix)</code> should return a number.
|
||||
testString: assert(typeof pathSumTwoWays(testMatrix) === 'number');
|
||||
- text: <code>pathSumTwoWays(testMatrix)</code> should return 2427.
|
||||
testString: assert.strictEqual(pathSumTwoWays(testMatrix), 2427);
|
||||
- text: <code>pathSumTwoWays(matrix)</code> should return 427337.
|
||||
testString: assert.strictEqual(pathSumTwoWays(matrix), 427337);
|
||||
|
||||
```
|
||||
|
||||
@ -45,12 +51,113 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler81() {
|
||||
function pathSumTwoWays(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler81();
|
||||
// Only change code above this line
|
||||
|
||||
const testMatrix = [
|
||||
[131, 673, 234, 103, 18],
|
||||
[201, 96, 342, 965, 150],
|
||||
[630, 803, 746, 422, 111],
|
||||
[537, 699, 497, 121, 956],
|
||||
[805, 732, 524, 37, 331]
|
||||
];
|
||||
|
||||
pathSumTwoWays(testMatrix);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
### Before Test
|
||||
<div id='js-setup'>
|
||||
|
||||
```js
|
||||
const matrix = [
|
||||
[4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870],
|
||||
[1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377],
|
||||
[9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230],
|
||||
[7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187],
|
||||
[3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505],
|
||||
[1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942],
|
||||
[4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757],
|
||||
[510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706],
|
||||
[9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048],
|
||||
[3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540],
|
||||
[6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442],
|
||||
[7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509],
|
||||
[4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000],
|
||||
[356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672],
|
||||
[9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785],
|
||||
[192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095],
|
||||
[1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859],
|
||||
[4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837],
|
||||
[5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286],
|
||||
[1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963],
|
||||
[1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127],
|
||||
[8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535],
|
||||
[7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446],
|
||||
[3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615],
|
||||
[9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303],
|
||||
[5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266],
|
||||
[6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763],
|
||||
[9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550],
|
||||
[5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887],
|
||||
[6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531],
|
||||
[5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739],
|
||||
[1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269],
|
||||
[4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380],
|
||||
[4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829],
|
||||
[8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873],
|
||||
[2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271],
|
||||
[6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281],
|
||||
[2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660],
|
||||
[6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665],
|
||||
[3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056],
|
||||
[5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089],
|
||||
[3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523],
|
||||
[1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616],
|
||||
[8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125],
|
||||
[3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307],
|
||||
[8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920],
|
||||
[8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225],
|
||||
[9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976],
|
||||
[3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432],
|
||||
[1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351],
|
||||
[7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991],
|
||||
[9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110],
|
||||
[7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965],
|
||||
[3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314],
|
||||
[1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416],
|
||||
[126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028],
|
||||
[8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407],
|
||||
[7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312],
|
||||
[4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000],
|
||||
[4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229],
|
||||
[7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256],
|
||||
[7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842],
|
||||
[6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241],
|
||||
[4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213],
|
||||
[9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015],
|
||||
[3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405],
|
||||
[2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640],
|
||||
[3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480],
|
||||
[4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181],
|
||||
[171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501],
|
||||
[3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698],
|
||||
[2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531],
|
||||
[7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255],
|
||||
[8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631],
|
||||
[2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914],
|
||||
[6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864],
|
||||
[8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738],
|
||||
[2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294],
|
||||
[2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789],
|
||||
[5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981]
|
||||
];
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,20 +7,23 @@ forumTopicId: 302196
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
NOTE: This problem is a more challenging version of Problem 81.
|
||||
|
||||
**Note:** This problem is a more challenging version of Problem 81.
|
||||
|
||||
The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to 994.
|
||||
|
||||
$$
|
||||
\begin{pmatrix}
|
||||
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\
|
||||
630 & 803 & 746 & 422 & 111\\
|
||||
537 & 699 & 497 & 121 & 956\\
|
||||
805 & 732 & 524 & 37 & 331
|
||||
\end{pmatrix}
|
||||
$$
|
||||
<div style='text-align: center;'>
|
||||
$\begin{pmatrix}
|
||||
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\
|
||||
630 & 803 & 746 & 422 & 111\\\\
|
||||
537 & 699 & 497 & 121 & 956\\\\
|
||||
805 & 732 & 524 & 37 & 331
|
||||
\end{pmatrix}$
|
||||
</div>
|
||||
|
||||
Find the minimal path sum from the left column to the right column in `matrix`, a 2D array containing an 80 by 80 matrix.
|
||||
|
||||
Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..."), a 31K text file containing a 80 by 80 matrix, from the left column to the right column.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -33,8 +36,12 @@ Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler82()</code> should return 260324.
|
||||
testString: assert.strictEqual(euler82(), 260324);
|
||||
- text: <code>pathSumThreeWays(testMatrix)</code> should return a number.
|
||||
testString: assert(typeof pathSumThreeWays(testMatrix) === 'number');
|
||||
- text: <code>pathSumThreeWays(testMatrix)</code> should return 994.
|
||||
testString: assert.strictEqual(pathSumThreeWays(testMatrix), 994);
|
||||
- text: <code>pathSumThreeWays(matrix)</code> should return 260324.
|
||||
testString: assert.strictEqual(pathSumThreeWays(matrix), 260324);
|
||||
|
||||
```
|
||||
|
||||
@ -46,12 +53,113 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler82() {
|
||||
function pathSumThreeWays(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler82();
|
||||
// Only change code above this line
|
||||
|
||||
const testMatrix = [
|
||||
[131, 673, 234, 103, 18],
|
||||
[201, 96, 342, 965, 150],
|
||||
[630, 803, 746, 422, 111],
|
||||
[537, 699, 497, 121, 956],
|
||||
[805, 732, 524, 37, 331]
|
||||
];
|
||||
|
||||
pathSumThreeWays(testMatrix);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
### Before Test
|
||||
<div id='js-setup'>
|
||||
|
||||
```js
|
||||
const matrix = [
|
||||
[4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870],
|
||||
[1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377],
|
||||
[9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230],
|
||||
[7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187],
|
||||
[3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505],
|
||||
[1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942],
|
||||
[4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757],
|
||||
[510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706],
|
||||
[9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048],
|
||||
[3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540],
|
||||
[6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442],
|
||||
[7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509],
|
||||
[4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000],
|
||||
[356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672],
|
||||
[9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785],
|
||||
[192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095],
|
||||
[1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859],
|
||||
[4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837],
|
||||
[5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286],
|
||||
[1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963],
|
||||
[1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127],
|
||||
[8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535],
|
||||
[7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446],
|
||||
[3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615],
|
||||
[9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303],
|
||||
[5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266],
|
||||
[6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763],
|
||||
[9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550],
|
||||
[5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887],
|
||||
[6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531],
|
||||
[5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739],
|
||||
[1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269],
|
||||
[4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380],
|
||||
[4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829],
|
||||
[8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873],
|
||||
[2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271],
|
||||
[6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281],
|
||||
[2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660],
|
||||
[6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665],
|
||||
[3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056],
|
||||
[5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089],
|
||||
[3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523],
|
||||
[1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616],
|
||||
[8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125],
|
||||
[3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307],
|
||||
[8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920],
|
||||
[8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225],
|
||||
[9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976],
|
||||
[3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432],
|
||||
[1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351],
|
||||
[7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991],
|
||||
[9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110],
|
||||
[7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965],
|
||||
[3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314],
|
||||
[1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416],
|
||||
[126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028],
|
||||
[8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407],
|
||||
[7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312],
|
||||
[4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000],
|
||||
[4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229],
|
||||
[7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256],
|
||||
[7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842],
|
||||
[6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241],
|
||||
[4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213],
|
||||
[9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015],
|
||||
[3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405],
|
||||
[2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640],
|
||||
[3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480],
|
||||
[4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181],
|
||||
[171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501],
|
||||
[3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698],
|
||||
[2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531],
|
||||
[7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255],
|
||||
[8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631],
|
||||
[2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914],
|
||||
[6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864],
|
||||
[8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738],
|
||||
[2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294],
|
||||
[2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789],
|
||||
[5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981]
|
||||
];
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,21 +7,23 @@ forumTopicId: 302197
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
NOTE: This problem is a significantly more challenging version of Problem 81.
|
||||
|
||||
**Note:** This problem is a significantly more challenging version of Problem 81.
|
||||
|
||||
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to 2297.
|
||||
|
||||
$$
|
||||
\begin{pmatrix}
|
||||
\color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\
|
||||
630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\
|
||||
537 & 699 & 497 & \color{red}{121} & 956\\
|
||||
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
|
||||
\end{pmatrix}
|
||||
$$
|
||||
<div style='text-align: center;'>
|
||||
$\begin{pmatrix}
|
||||
\color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\
|
||||
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\
|
||||
630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\
|
||||
537 & 699 & 497 & \color{red}{121} & 956\\\\
|
||||
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
|
||||
\end{pmatrix}$
|
||||
</div>
|
||||
|
||||
Find the minimal path sum from the top left to the bottom right by moving left, right, up, and down in `matrix`, a 2D array defined in the background, containing an 80 by 80 matrix.
|
||||
|
||||
Find the minimal path sum, in matrix.txt (right click and
|
||||
"Save Link/Target As..."), a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right by moving left, right, up, and down.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -34,8 +36,12 @@ Find the minimal path sum, in matrix.txt (right click and
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler83()</code> should return 425185.
|
||||
testString: assert.strictEqual(euler83(), 425185);
|
||||
- text: <code>pathSumFourWays(testMatrix)</code> should return a number.
|
||||
testString: assert(typeof pathSumFourWays(testMatrix) === 'number');
|
||||
- text: <code>pathSumFourWays(testMatrix)</code> should return 2297.
|
||||
testString: assert.strictEqual(pathSumFourWays(testMatrix), 2297);
|
||||
- text: <code>pathSumFourWays(matrix)</code> should return 425185.
|
||||
testString: assert.strictEqual(pathSumFourWays(matrix), 425185);
|
||||
|
||||
```
|
||||
|
||||
@ -47,12 +53,113 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler83() {
|
||||
function pathSumFourWays(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler83();
|
||||
// Only change code above this line
|
||||
|
||||
const testMatrix = [
|
||||
[131, 673, 234, 103, 18],
|
||||
[201, 96, 342, 965, 150],
|
||||
[630, 803, 746, 422, 111],
|
||||
[537, 699, 497, 121, 956],
|
||||
[805, 732, 524, 37, 331]
|
||||
];
|
||||
|
||||
pathSumFourWays(testMatrix);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
### Before Test
|
||||
<div id='js-setup'>
|
||||
|
||||
```js
|
||||
const matrix = [
|
||||
[4445,2697,5115,718,2209,2212,654,4348,3079,6821,7668,3276,8874,4190,3785,2752,9473,7817,9137,496,7338,3434,7152,4355,4552,7917,7827,2460,2350,691,3514,5880,3145,7633,7199,3783,5066,7487,3285,1084,8985,760,872,8609,8051,1134,9536,5750,9716,9371,7619,5617,275,9721,2997,2698,1887,8825,6372,3014,2113,7122,7050,6775,5948,2758,1219,3539,348,7989,2735,9862,1263,8089,6401,9462,3168,2758,3748,5870],
|
||||
[1096,20,1318,7586,5167,2642,1443,5741,7621,7030,5526,4244,2348,4641,9827,2448,6918,5883,3737,300,7116,6531,567,5997,3971,6623,820,6148,3287,1874,7981,8424,7672,7575,6797,6717,1078,5008,4051,8795,5820,346,1851,6463,2117,6058,3407,8211,117,4822,1317,4377,4434,5925,8341,4800,1175,4173,690,8978,7470,1295,3799,8724,3509,9849,618,3320,7068,9633,2384,7175,544,6583,1908,9983,481,4187,9353,9377],
|
||||
[9607,7385,521,6084,1364,8983,7623,1585,6935,8551,2574,8267,4781,3834,2764,2084,2669,4656,9343,7709,2203,9328,8004,6192,5856,3555,2260,5118,6504,1839,9227,1259,9451,1388,7909,5733,6968,8519,9973,1663,5315,7571,3035,4325,4283,2304,6438,3815,9213,9806,9536,196,5542,6907,2475,1159,5820,9075,9470,2179,9248,1828,4592,9167,3713,4640,47,3637,309,7344,6955,346,378,9044,8635,7466,5036,9515,6385,9230],
|
||||
[7206,3114,7760,1094,6150,5182,7358,7387,4497,955,101,1478,7777,6966,7010,8417,6453,4955,3496,107,449,8271,131,2948,6185,784,5937,8001,6104,8282,4165,3642,710,2390,575,715,3089,6964,4217,192,5949,7006,715,3328,1152,66,8044,4319,1735,146,4818,5456,6451,4113,1063,4781,6799,602,1504,6245,6550,1417,1343,2363,3785,5448,4545,9371,5420,5068,4613,4882,4241,5043,7873,8042,8434,3939,9256,2187],
|
||||
[3620,8024,577,9997,7377,7682,1314,1158,6282,6310,1896,2509,5436,1732,9480,706,496,101,6232,7375,2207,2306,110,6772,3433,2878,8140,5933,8688,1399,2210,7332,6172,6403,7333,4044,2291,1790,2446,7390,8698,5723,3678,7104,1825,2040,140,3982,4905,4160,2200,5041,2512,1488,2268,1175,7588,8321,8078,7312,977,5257,8465,5068,3453,3096,1651,7906,253,9250,6021,8791,8109,6651,3412,345,4778,5152,4883,7505],
|
||||
[1074,5438,9008,2679,5397,5429,2652,3403,770,9188,4248,2493,4361,8327,9587,707,9525,5913,93,1899,328,2876,3604,673,8576,6908,7659,2544,3359,3883,5273,6587,3065,1749,3223,604,9925,6941,2823,8767,7039,3290,3214,1787,7904,3421,7137,9560,8451,2669,9219,6332,1576,5477,6755,8348,4164,4307,2984,4012,6629,1044,2874,6541,4942,903,1404,9125,5160,8836,4345,2581,460,8438,1538,5507,668,3352,2678,6942],
|
||||
[4295,1176,5596,1521,3061,9868,7037,7129,8933,6659,5947,5063,3653,9447,9245,2679,767,714,116,8558,163,3927,8779,158,5093,2447,5782,3967,1716,931,7772,8164,1117,9244,5783,7776,3846,8862,6014,2330,6947,1777,3112,6008,3491,1906,5952,314,4602,8994,5919,9214,3995,5026,7688,6809,5003,3128,2509,7477,110,8971,3982,8539,2980,4689,6343,5411,2992,5270,5247,9260,2269,7474,1042,7162,5206,1232,4556,4757],
|
||||
[510,3556,5377,1406,5721,4946,2635,7847,4251,8293,8281,6351,4912,287,2870,3380,3948,5322,3840,4738,9563,1906,6298,3234,8959,1562,6297,8835,7861,239,6618,1322,2553,2213,5053,5446,4402,6500,5182,8585,6900,5756,9661,903,5186,7687,5998,7997,8081,8955,4835,6069,2621,1581,732,9564,1082,1853,5442,1342,520,1737,3703,5321,4793,2776,1508,1647,9101,2499,6891,4336,7012,3329,3212,1442,9993,3988,4930,7706],
|
||||
[9444,3401,5891,9716,1228,7107,109,3563,2700,6161,5039,4992,2242,8541,7372,2067,1294,3058,1306,320,8881,5756,9326,411,8650,8824,5495,8282,8397,2000,1228,7817,2099,6473,3571,5994,4447,1299,5991,543,7874,2297,1651,101,2093,3463,9189,6872,6118,872,1008,1779,2805,9084,4048,2123,5877,55,3075,1737,9459,4535,6453,3644,108,5982,4437,5213,1340,6967,9943,5815,669,8074,1838,6979,9132,9315,715,5048],
|
||||
[3327,4030,7177,6336,9933,5296,2621,4785,2755,4832,2512,2118,2244,4407,2170,499,7532,9742,5051,7687,970,6924,3527,4694,5145,1306,2165,5940,2425,8910,3513,1909,6983,346,6377,4304,9330,7203,6605,3709,3346,970,369,9737,5811,4427,9939,3693,8436,5566,1977,3728,2399,3985,8303,2492,5366,9802,9193,7296,1033,5060,9144,2766,1151,7629,5169,5995,58,7619,7565,4208,1713,6279,3209,4908,9224,7409,1325,8540],
|
||||
[6882,1265,1775,3648,4690,959,5837,4520,5394,1378,9485,1360,4018,578,9174,2932,9890,3696,116,1723,1178,9355,7063,1594,1918,8574,7594,7942,1547,6166,7888,354,6932,4651,1010,7759,6905,661,7689,6092,9292,3845,9605,8443,443,8275,5163,7720,7265,6356,7779,1798,1754,5225,6661,1180,8024,5666,88,9153,1840,3508,1193,4445,2648,3538,6243,6375,8107,5902,5423,2520,1122,5015,6113,8859,9370,966,8673,2442],
|
||||
[7338,3423,4723,6533,848,8041,7921,8277,4094,5368,7252,8852,9166,2250,2801,6125,8093,5738,4038,9808,7359,9494,601,9116,4946,2702,5573,2921,9862,1462,1269,2410,4171,2709,7508,6241,7522,615,2407,8200,4189,5492,5649,7353,2590,5203,4274,710,7329,9063,956,8371,3722,4253,4785,1194,4828,4717,4548,940,983,2575,4511,2938,1827,2027,2700,1236,841,5760,1680,6260,2373,3851,1841,4968,1172,5179,7175,3509],
|
||||
[4420,1327,3560,2376,6260,2988,9537,4064,4829,8872,9598,3228,1792,7118,9962,9336,4368,9189,6857,1829,9863,6287,7303,7769,2707,8257,2391,2009,3975,4993,3068,9835,3427,341,8412,2134,4034,8511,6421,3041,9012,2983,7289,100,1355,7904,9186,6920,5856,2008,6545,8331,3655,5011,839,8041,9255,6524,3862,8788,62,7455,3513,5003,8413,3918,2076,7960,6108,3638,6999,3436,1441,4858,4181,1866,8731,7745,3744,1000],
|
||||
[356,8296,8325,1058,1277,4743,3850,2388,6079,6462,2815,5620,8495,5378,75,4324,3441,9870,1113,165,1544,1179,2834,562,6176,2313,6836,8839,2986,9454,5199,6888,1927,5866,8760,320,1792,8296,7898,6121,7241,5886,5814,2815,8336,1576,4314,3109,2572,6011,2086,9061,9403,3947,5487,9731,7281,3159,1819,1334,3181,5844,5114,9898,4634,2531,4412,6430,4262,8482,4546,4555,6804,2607,9421,686,8649,8860,7794,6672],
|
||||
[9870,152,1558,4963,8750,4754,6521,6256,8818,5208,5691,9659,8377,9725,5050,5343,2539,6101,1844,9700,7750,8114,5357,3001,8830,4438,199,9545,8496,43,2078,327,9397,106,6090,8181,8646,6414,7499,5450,4850,6273,5014,4131,7639,3913,6571,8534,9703,4391,7618,445,1320,5,1894,6771,7383,9191,4708,9706,6939,7937,8726,9382,5216,3685,2247,9029,8154,1738,9984,2626,9438,4167,6351,5060,29,1218,1239,4785],
|
||||
[192,5213,8297,8974,4032,6966,5717,1179,6523,4679,9513,1481,3041,5355,9303,9154,1389,8702,6589,7818,6336,3539,5538,3094,6646,6702,6266,2759,4608,4452,617,9406,8064,6379,444,5602,4950,1810,8391,1536,316,8714,1178,5182,5863,5110,5372,4954,1978,2971,5680,4863,2255,4630,5723,2168,538,1692,1319,7540,440,6430,6266,7712,7385,5702,620,641,3136,7350,1478,3155,2820,9109,6261,1122,4470,14,8493,2095],
|
||||
[1046,4301,6082,474,4974,7822,2102,5161,5172,6946,8074,9716,6586,9962,9749,5015,2217,995,5388,4402,7652,6399,6539,1349,8101,3677,1328,9612,7922,2879,231,5887,2655,508,4357,4964,3554,5930,6236,7384,4614,280,3093,9600,2110,7863,2631,6626,6620,68,1311,7198,7561,1768,5139,1431,221,230,2940,968,5283,6517,2146,1646,869,9402,7068,8645,7058,1765,9690,4152,2926,9504,2939,7504,6074,2944,6470,7859],
|
||||
[4659,736,4951,9344,1927,6271,8837,8711,3241,6579,7660,5499,5616,3743,5801,4682,9748,8796,779,1833,4549,8138,4026,775,4170,2432,4174,3741,7540,8017,2833,4027,396,811,2871,1150,9809,2719,9199,8504,1224,540,2051,3519,7982,7367,2761,308,3358,6505,2050,4836,5090,7864,805,2566,2409,6876,3361,8622,5572,5895,3280,441,7893,8105,1634,2929,274,3926,7786,6123,8233,9921,2674,5340,1445,203,4585,3837],
|
||||
[5759,338,7444,7968,7742,3755,1591,4839,1705,650,7061,2461,9230,9391,9373,2413,1213,431,7801,4994,2380,2703,6161,6878,8331,2538,6093,1275,5065,5062,2839,582,1014,8109,3525,1544,1569,8622,7944,2905,6120,1564,1839,5570,7579,1318,2677,5257,4418,5601,7935,7656,5192,1864,5886,6083,5580,6202,8869,1636,7907,4759,9082,5854,3185,7631,6854,5872,5632,5280,1431,2077,9717,7431,4256,8261,9680,4487,4752,4286],
|
||||
[1571,1428,8599,1230,7772,4221,8523,9049,4042,8726,7567,6736,9033,2104,4879,4967,6334,6716,3994,1269,8995,6539,3610,7667,6560,6065,874,848,4597,1711,7161,4811,6734,5723,6356,6026,9183,2586,5636,1092,7779,7923,8747,6887,7505,9909,1792,3233,4526,3176,1508,8043,720,5212,6046,4988,709,5277,8256,3642,1391,5803,1468,2145,3970,6301,7767,2359,8487,9771,8785,7520,856,1605,8972,2402,2386,991,1383,5963],
|
||||
[1822,4824,5957,6511,9868,4113,301,9353,6228,2881,2966,6956,9124,9574,9233,1601,7340,973,9396,540,4747,8590,9535,3650,7333,7583,4806,3593,2738,8157,5215,8472,2284,9473,3906,6982,5505,6053,7936,6074,7179,6688,1564,1103,6860,5839,2022,8490,910,7551,7805,881,7024,1855,9448,4790,1274,3672,2810,774,7623,4223,4850,6071,9975,4935,1915,9771,6690,3846,517,463,7624,4511,614,6394,3661,7409,1395,8127],
|
||||
[8738,3850,9555,3695,4383,2378,87,6256,6740,7682,9546,4255,6105,2000,1851,4073,8957,9022,6547,5189,2487,303,9602,7833,1628,4163,6678,3144,8589,7096,8913,5823,4890,7679,1212,9294,5884,2972,3012,3359,7794,7428,1579,4350,7246,4301,7779,7790,3294,9547,4367,3549,1958,8237,6758,3497,3250,3456,6318,1663,708,7714,6143,6890,3428,6853,9334,7992,591,6449,9786,1412,8500,722,5468,1371,108,3939,4199,2535],
|
||||
[7047,4323,1934,5163,4166,461,3544,2767,6554,203,6098,2265,9078,2075,4644,6641,8412,9183,487,101,7566,5622,1975,5726,2920,5374,7779,5631,3753,3725,2672,3621,4280,1162,5812,345,8173,9785,1525,955,5603,2215,2580,5261,2765,2990,5979,389,3907,2484,1232,5933,5871,3304,1138,1616,5114,9199,5072,7442,7245,6472,4760,6359,9053,7876,2564,9404,3043,9026,2261,3374,4460,7306,2326,966,828,3274,1712,3446],
|
||||
[3975,4565,8131,5800,4570,2306,8838,4392,9147,11,3911,7118,9645,4994,2028,6062,5431,2279,8752,2658,7836,994,7316,5336,7185,3289,1898,9689,2331,5737,3403,1124,2679,3241,7748,16,2724,5441,6640,9368,9081,5618,858,4969,17,2103,6035,8043,7475,2181,939,415,1617,8500,8253,2155,7843,7974,7859,1746,6336,3193,2617,8736,4079,6324,6645,8891,9396,5522,6103,1857,8979,3835,2475,1310,7422,610,8345,7615],
|
||||
[9248,5397,5686,2988,3446,4359,6634,9141,497,9176,6773,7448,1907,8454,916,1596,2241,1626,1384,2741,3649,5362,8791,7170,2903,2475,5325,6451,924,3328,522,90,4813,9737,9557,691,2388,1383,4021,1609,9206,4707,5200,7107,8104,4333,9860,5013,1224,6959,8527,1877,4545,7772,6268,621,4915,9349,5970,706,9583,3071,4127,780,8231,3017,9114,3836,7503,2383,1977,4870,8035,2379,9704,1037,3992,3642,1016,4303],
|
||||
[5093,138,4639,6609,1146,5565,95,7521,9077,2272,974,4388,2465,2650,722,4998,3567,3047,921,2736,7855,173,2065,4238,1048,5,6847,9548,8632,9194,5942,4777,7910,8971,6279,7253,2516,1555,1833,3184,9453,9053,6897,7808,8629,4877,1871,8055,4881,7639,1537,7701,2508,7564,5845,5023,2304,5396,3193,2955,1088,3801,6203,1748,3737,1276,13,4120,7715,8552,3047,2921,106,7508,304,1280,7140,2567,9135,5266],
|
||||
[6237,4607,7527,9047,522,7371,4883,2540,5867,6366,5301,1570,421,276,3361,527,6637,4861,2401,7522,5808,9371,5298,2045,5096,5447,7755,5115,7060,8529,4078,1943,1697,1764,5453,7085,960,2405,739,2100,5800,728,9737,5704,5693,1431,8979,6428,673,7540,6,7773,5857,6823,150,5869,8486,684,5816,9626,7451,5579,8260,3397,5322,6920,1879,2127,2884,5478,4977,9016,6165,6292,3062,5671,5968,78,4619,4763],
|
||||
[9905,7127,9390,5185,6923,3721,9164,9705,4341,1031,1046,5127,7376,6528,3248,4941,1178,7889,3364,4486,5358,9402,9158,8600,1025,874,1839,1783,309,9030,1843,845,8398,1433,7118,70,8071,2877,3904,8866,6722,4299,10,1929,5897,4188,600,1889,3325,2485,6473,4474,7444,6992,4846,6166,4441,2283,2629,4352,7775,1101,2214,9985,215,8270,9750,2740,8361,7103,5930,8664,9690,8302,9267,344,2077,1372,1880,9550],
|
||||
[5825,8517,7769,2405,8204,1060,3603,7025,478,8334,1997,3692,7433,9101,7294,7498,9415,5452,3850,3508,6857,9213,6807,4412,7310,854,5384,686,4978,892,8651,3241,2743,3801,3813,8588,6701,4416,6990,6490,3197,6838,6503,114,8343,5844,8646,8694,65,791,5979,2687,2621,2019,8097,1423,3644,9764,4921,3266,3662,5561,2476,8271,8138,6147,1168,3340,1998,9874,6572,9873,6659,5609,2711,3931,9567,4143,7833,8887],
|
||||
[6223,2099,2700,589,4716,8333,1362,5007,2753,2848,4441,8397,7192,8191,4916,9955,6076,3370,6396,6971,3156,248,3911,2488,4930,2458,7183,5455,170,6809,6417,3390,1956,7188,577,7526,2203,968,8164,479,8699,7915,507,6393,4632,1597,7534,3604,618,3280,6061,9793,9238,8347,568,9645,2070,5198,6482,5000,9212,6655,5961,7513,1323,3872,6170,3812,4146,2736,67,3151,5548,2781,9679,7564,5043,8587,1893,4531],
|
||||
[5826,3690,6724,2121,9308,6986,8106,6659,2142,1642,7170,2877,5757,6494,8026,6571,8387,9961,6043,9758,9607,6450,8631,8334,7359,5256,8523,2225,7487,1977,9555,8048,5763,2414,4948,4265,2427,8978,8088,8841,9208,9601,5810,9398,8866,9138,4176,5875,7212,3272,6759,5678,7649,4922,5422,1343,8197,3154,3600,687,1028,4579,2084,9467,4492,7262,7296,6538,7657,7134,2077,1505,7332,6890,8964,4879,7603,7400,5973,739],
|
||||
[1861,1613,4879,1884,7334,966,2000,7489,2123,4287,1472,3263,4726,9203,1040,4103,6075,6049,330,9253,4062,4268,1635,9960,577,1320,3195,9628,1030,4092,4979,6474,6393,2799,6967,8687,7724,7392,9927,2085,3200,6466,8702,265,7646,8665,7986,7266,4574,6587,612,2724,704,3191,8323,9523,3002,704,5064,3960,8209,2027,2758,8393,4875,4641,9584,6401,7883,7014,768,443,5490,7506,1852,2005,8850,5776,4487,4269],
|
||||
[4052,6687,4705,7260,6645,6715,3706,5504,8672,2853,1136,8187,8203,4016,871,1809,1366,4952,9294,5339,6872,2645,6083,7874,3056,5218,7485,8796,7401,3348,2103,426,8572,4163,9171,3176,948,7654,9344,3217,1650,5580,7971,2622,76,2874,880,2034,9929,1546,2659,5811,3754,7096,7436,9694,9960,7415,2164,953,2360,4194,2397,1047,2196,6827,575,784,2675,8821,6802,7972,5996,6699,2134,7577,2887,1412,4349,4380],
|
||||
[4629,2234,6240,8132,7592,3181,6389,1214,266,1910,2451,8784,2790,1127,6932,1447,8986,2492,5476,397,889,3027,7641,5083,5776,4022,185,3364,5701,2442,2840,4160,9525,4828,6602,2614,7447,3711,4505,7745,8034,6514,4907,2605,7753,6958,7270,6936,3006,8968,439,2326,4652,3085,3425,9863,5049,5361,8688,297,7580,8777,7916,6687,8683,7141,306,9569,2384,1500,3346,4601,7329,9040,6097,2727,6314,4501,4974,2829],
|
||||
[8316,4072,2025,6884,3027,1808,5714,7624,7880,8528,4205,8686,7587,3230,1139,7273,6163,6986,3914,9309,1464,9359,4474,7095,2212,7302,2583,9462,7532,6567,1606,4436,8981,5612,6796,4385,5076,2007,6072,3678,8331,1338,3299,8845,4783,8613,4071,1232,6028,2176,3990,2148,3748,103,9453,538,6745,9110,926,3125,473,5970,8728,7072,9062,1404,1317,5139,9862,6496,6062,3338,464,1600,2532,1088,8232,7739,8274,3873],
|
||||
[2341,523,7096,8397,8301,6541,9844,244,4993,2280,7689,4025,4196,5522,7904,6048,2623,9258,2149,9461,6448,8087,7245,1917,8340,7127,8466,5725,6996,3421,5313,512,9164,9837,9794,8369,4185,1488,7210,1524,1016,4620,9435,2478,7765,8035,697,6677,3724,6988,5853,7662,3895,9593,1185,4727,6025,5734,7665,3070,138,8469,6748,6459,561,7935,8646,2378,462,7755,3115,9690,8877,3946,2728,8793,244,6323,8666,4271],
|
||||
[6430,2406,8994,56,1267,3826,9443,7079,7579,5232,6691,3435,6718,5698,4144,7028,592,2627,217,734,6194,8156,9118,58,2640,8069,4127,3285,694,3197,3377,4143,4802,3324,8134,6953,7625,3598,3584,4289,7065,3434,2106,7132,5802,7920,9060,7531,3321,1725,1067,3751,444,5503,6785,7937,6365,4803,198,6266,8177,1470,6390,1606,2904,7555,9834,8667,2033,1723,5167,1666,8546,8152,473,4475,6451,7947,3062,3281],
|
||||
[2810,3042,7759,1741,2275,2609,7676,8640,4117,1958,7500,8048,1757,3954,9270,1971,4796,2912,660,5511,3553,1012,5757,4525,6084,7198,8352,5775,7726,8591,7710,9589,3122,4392,6856,5016,749,2285,3356,7482,9956,7348,2599,8944,495,3462,3578,551,4543,7207,7169,7796,1247,4278,6916,8176,3742,8385,2310,1345,8692,2667,4568,1770,8319,3585,4920,3890,4928,7343,5385,9772,7947,8786,2056,9266,3454,2807,877,2660],
|
||||
[6206,8252,5928,5837,4177,4333,207,7934,5581,9526,8906,1498,8411,2984,5198,5134,2464,8435,8514,8674,3876,599,5327,826,2152,4084,2433,9327,9697,4800,2728,3608,3849,3861,3498,9943,1407,3991,7191,9110,5666,8434,4704,6545,5944,2357,1163,4995,9619,6754,4200,9682,6654,4862,4744,5953,6632,1054,293,9439,8286,2255,696,8709,1533,1844,6441,430,1999,6063,9431,7018,8057,2920,6266,6799,356,3597,4024,6665],
|
||||
[3847,6356,8541,7225,2325,2946,5199,469,5450,7508,2197,9915,8284,7983,6341,3276,3321,16,1321,7608,5015,3362,8491,6968,6818,797,156,2575,706,9516,5344,5457,9210,5051,8099,1617,9951,7663,8253,9683,2670,1261,4710,1068,8753,4799,1228,2621,3275,6188,4699,1791,9518,8701,5932,4275,6011,9877,2933,4182,6059,2930,6687,6682,9771,654,9437,3169,8596,1827,5471,8909,2352,123,4394,3208,8756,5513,6917,2056],
|
||||
[5458,8173,3138,3290,4570,4892,3317,4251,9699,7973,1163,1935,5477,6648,9614,5655,9592,975,9118,2194,7322,8248,8413,3462,8560,1907,7810,6650,7355,2939,4973,6894,3933,3784,3200,2419,9234,4747,2208,2207,1945,2899,1407,6145,8023,3484,5688,7686,2737,3828,3704,9004,5190,9740,8643,8650,5358,4426,1522,1707,3613,9887,6956,2447,2762,833,1449,9489,2573,1080,4167,3456,6809,2466,227,7125,2759,6250,6472,8089],
|
||||
[3266,7025,9756,3914,1265,9116,7723,9788,6805,5493,2092,8688,6592,9173,4431,4028,6007,7131,4446,4815,3648,6701,759,3312,8355,4485,4187,5188,8746,7759,3528,2177,5243,8379,3838,7233,4607,9187,7216,2190,6967,2920,6082,7910,5354,3609,8958,6949,7731,494,8753,8707,1523,4426,3543,7085,647,6771,9847,646,5049,824,8417,5260,2730,5702,2513,9275,4279,2767,8684,1165,9903,4518,55,9682,8963,6005,2102,6523],
|
||||
[1998,8731,936,1479,5259,7064,4085,91,7745,7136,3773,3810,730,8255,2705,2653,9790,6807,2342,355,9344,2668,3690,2028,9679,8102,574,4318,6481,9175,5423,8062,2867,9657,7553,3442,3920,7430,3945,7639,3714,3392,2525,4995,4850,2867,7951,9667,486,9506,9888,781,8866,1702,3795,90,356,1483,4200,2131,6969,5931,486,6880,4404,1084,5169,4910,6567,8335,4686,5043,2614,3352,2667,4513,6472,7471,5720,1616],
|
||||
[8878,1613,1716,868,1906,2681,564,665,5995,2474,7496,3432,9491,9087,8850,8287,669,823,347,6194,2264,2592,7871,7616,8508,4827,760,2676,4660,4881,7572,3811,9032,939,4384,929,7525,8419,5556,9063,662,8887,7026,8534,3111,1454,2082,7598,5726,6687,9647,7608,73,3014,5063,670,5461,5631,3367,9796,8475,7908,5073,1565,5008,5295,4457,1274,4788,1728,338,600,8415,8535,9351,7750,6887,5845,1741,125],
|
||||
[3637,6489,9634,9464,9055,2413,7824,9517,7532,3577,7050,6186,6980,9365,9782,191,870,2497,8498,2218,2757,5420,6468,586,3320,9230,1034,1393,9886,5072,9391,1178,8464,8042,6869,2075,8275,3601,7715,9470,8786,6475,8373,2159,9237,2066,3264,5000,679,355,3069,4073,494,2308,5512,4334,9438,8786,8637,9774,1169,1949,6594,6072,4270,9158,7916,5752,6794,9391,6301,5842,3285,2141,3898,8027,4310,8821,7079,1307],
|
||||
[8497,6681,4732,7151,7060,5204,9030,7157,833,5014,8723,3207,9796,9286,4913,119,5118,7650,9335,809,3675,2597,5144,3945,5090,8384,187,4102,1260,2445,2792,4422,8389,9290,50,1765,1521,6921,8586,4368,1565,5727,7855,2003,4834,9897,5911,8630,5070,1330,7692,7557,7980,6028,5805,9090,8265,3019,3802,698,9149,5748,1965,9658,4417,5994,5584,8226,2937,272,5743,1278,5698,8736,2595,6475,5342,6596,1149,6920],
|
||||
[8188,8009,9546,6310,8772,2500,9846,6592,6872,3857,1307,8125,7042,1544,6159,2330,643,4604,7899,6848,371,8067,2062,3200,7295,1857,9505,6936,384,2193,2190,301,8535,5503,1462,7380,5114,4824,8833,1763,4974,8711,9262,6698,3999,2645,6937,7747,1128,2933,3556,7943,2885,3122,9105,5447,418,2899,5148,3699,9021,9501,597,4084,175,1621,1,1079,6067,5812,4326,9914,6633,5394,4233,6728,9084,1864,5863,1225],
|
||||
[9935,8793,9117,1825,9542,8246,8437,3331,9128,9675,6086,7075,319,1334,7932,3583,7167,4178,1726,7720,695,8277,7887,6359,5912,1719,2780,8529,1359,2013,4498,8072,1129,9998,1147,8804,9405,6255,1619,2165,7491,1,8882,7378,3337,503,5758,4109,3577,985,3200,7615,8058,5032,1080,6410,6873,5496,1466,2412,9885,5904,4406,3605,8770,4361,6205,9193,1537,9959,214,7260,9566,1685,100,4920,7138,9819,5637,976],
|
||||
[3466,9854,985,1078,7222,8888,5466,5379,3578,4540,6853,8690,3728,6351,7147,3134,6921,9692,857,3307,4998,2172,5783,3931,9417,2541,6299,13,787,2099,9131,9494,896,8600,1643,8419,7248,2660,2609,8579,91,6663,5506,7675,1947,6165,4286,1972,9645,3805,1663,1456,8853,5705,9889,7489,1107,383,4044,2969,3343,152,7805,4980,9929,5033,1737,9953,7197,9158,4071,1324,473,9676,3984,9680,3606,8160,7384,5432],
|
||||
[1005,4512,5186,3953,2164,3372,4097,3247,8697,3022,9896,4101,3871,6791,3219,2742,4630,6967,7829,5991,6134,1197,1414,8923,8787,1394,8852,5019,7768,5147,8004,8825,5062,9625,7988,1110,3992,7984,9966,6516,6251,8270,421,3723,1432,4830,6935,8095,9059,2214,6483,6846,3120,1587,6201,6691,9096,9627,6671,4002,3495,9939,7708,7465,5879,6959,6634,3241,3401,2355,9061,2611,7830,3941,2177,2146,5089,7079,519,6351],
|
||||
[7280,8586,4261,2831,7217,3141,9994,9940,5462,2189,4005,6942,9848,5350,8060,6665,7519,4324,7684,657,9453,9296,2944,6843,7499,7847,1728,9681,3906,6353,5529,2822,3355,3897,7724,4257,7489,8672,4356,3983,1948,6892,7415,4153,5893,4190,621,1736,4045,9532,7701,3671,1211,1622,3176,4524,9317,7800,5638,6644,6943,5463,3531,2821,1347,5958,3436,1438,2999,994,850,4131,2616,1549,3465,5946,690,9273,6954,7991],
|
||||
[9517,399,3249,2596,7736,2142,1322,968,7350,1614,468,3346,3265,7222,6086,1661,5317,2582,7959,4685,2807,2917,1037,5698,1529,3972,8716,2634,3301,3412,8621,743,8001,4734,888,7744,8092,3671,8941,1487,5658,7099,2781,99,1932,4443,4756,4652,9328,1581,7855,4312,5976,7255,6480,3996,2748,1973,9731,4530,2790,9417,7186,5303,3557,351,7182,9428,1342,9020,7599,1392,8304,2070,9138,7215,2008,9937,1106,7110],
|
||||
[7444,769,9688,632,1571,6820,8743,4338,337,3366,3073,1946,8219,104,4210,6986,249,5061,8693,7960,6546,1004,8857,5997,9352,4338,6105,5008,2556,6518,6694,4345,3727,7956,20,3954,8652,4424,9387,2035,8358,5962,5304,5194,8650,8282,1256,1103,2138,6679,1985,3653,2770,2433,4278,615,2863,1715,242,3790,2636,6998,3088,1671,2239,957,5411,4595,6282,2881,9974,2401,875,7574,2987,4587,3147,6766,9885,2965],
|
||||
[3287,3016,3619,6818,9073,6120,5423,557,2900,2015,8111,3873,1314,4189,1846,4399,7041,7583,2427,2864,3525,5002,2069,748,1948,6015,2684,438,770,8367,1663,7887,7759,1885,157,7770,4520,4878,3857,1137,3525,3050,6276,5569,7649,904,4533,7843,2199,5648,7628,9075,9441,3600,7231,2388,5640,9096,958,3058,584,5899,8150,1181,9616,1098,8162,6819,8171,1519,1140,7665,8801,2632,1299,9192,707,9955,2710,7314],
|
||||
[1772,2963,7578,3541,3095,1488,7026,2634,6015,4633,4370,2762,1650,2174,909,8158,2922,8467,4198,4280,9092,8856,8835,5457,2790,8574,9742,5054,9547,4156,7940,8126,9824,7340,8840,6574,3547,1477,3014,6798,7134,435,9484,9859,3031,4,1502,4133,1738,1807,4825,463,6343,9701,8506,9822,9555,8688,8168,3467,3234,6318,1787,5591,419,6593,7974,8486,9861,6381,6758,194,3061,4315,2863,4665,3789,2201,1492,4416],
|
||||
[126,8927,6608,5682,8986,6867,1715,6076,3159,788,3140,4744,830,9253,5812,5021,7616,8534,1546,9590,1101,9012,9821,8132,7857,4086,1069,7491,2988,1579,2442,4321,2149,7642,6108,250,6086,3167,24,9528,7663,2685,1220,9196,1397,5776,1577,1730,5481,977,6115,199,6326,2183,3767,5928,5586,7561,663,8649,9688,949,5913,9160,1870,5764,9887,4477,6703,1413,4995,5494,7131,2192,8969,7138,3997,8697,646,1028],
|
||||
[8074,1731,8245,624,4601,8706,155,8891,309,2552,8208,8452,2954,3124,3469,4246,3352,1105,4509,8677,9901,4416,8191,9283,5625,7120,2952,8881,7693,830,4580,8228,9459,8611,4499,1179,4988,1394,550,2336,6089,6872,269,7213,1848,917,6672,4890,656,1478,6536,3165,4743,4990,1176,6211,7207,5284,9730,4738,1549,4986,4942,8645,3698,9429,1439,2175,6549,3058,6513,1574,6988,8333,3406,5245,5431,7140,7085,6407],
|
||||
[7845,4694,2530,8249,290,5948,5509,1588,5940,4495,5866,5021,4626,3979,3296,7589,4854,1998,5627,3926,8346,6512,9608,1918,7070,4747,4182,2858,2766,4606,6269,4107,8982,8568,9053,4244,5604,102,2756,727,5887,2566,7922,44,5986,621,1202,374,6988,4130,3627,6744,9443,4568,1398,8679,397,3928,9159,367,2917,6127,5788,3304,8129,911,2669,1463,9749,264,4478,8940,1109,7309,2462,117,4692,7724,225,2312],
|
||||
[4164,3637,2000,941,8903,39,3443,7172,1031,3687,4901,8082,4945,4515,7204,9310,9349,9535,9940,218,1788,9245,2237,1541,5670,6538,6047,5553,9807,8101,1925,8714,445,8332,7309,6830,5786,5736,7306,2710,3034,1838,7969,6318,7912,2584,2080,7437,6705,2254,7428,820,782,9861,7596,3842,3631,8063,5240,6666,394,4565,7865,4895,9890,6028,6117,4724,9156,4473,4552,602,470,6191,4927,5387,884,3146,1978,3000],
|
||||
[4258,6880,1696,3582,5793,4923,2119,1155,9056,9698,6603,3768,5514,9927,9609,6166,6566,4536,4985,4934,8076,9062,6741,6163,7399,4562,2337,5600,2919,9012,8459,1308,6072,1225,9306,8818,5886,7243,7365,8792,6007,9256,6699,7171,4230,7002,8720,7839,4533,1671,478,7774,1607,2317,5437,4705,7886,4760,6760,7271,3081,2997,3088,7675,6208,3101,6821,6840,122,9633,4900,2067,8546,4549,2091,7188,5605,8599,6758,5229],
|
||||
[7854,5243,9155,3556,8812,7047,2202,1541,5993,4600,4760,713,434,7911,7426,7414,8729,322,803,7960,7563,4908,6285,6291,736,3389,9339,4132,8701,7534,5287,3646,592,3065,7582,2592,8755,6068,8597,1982,5782,1894,2900,6236,4039,6569,3037,5837,7698,700,7815,2491,7272,5878,3083,6778,6639,3589,5010,8313,2581,6617,5869,8402,6808,2951,2321,5195,497,2190,6187,1342,1316,4453,7740,4154,2959,1781,1482,8256],
|
||||
[7178,2046,4419,744,8312,5356,6855,8839,319,2962,5662,47,6307,8662,68,4813,567,2712,9931,1678,3101,8227,6533,4933,6656,92,5846,4780,6256,6361,4323,9985,1231,2175,7178,3034,9744,6155,9165,7787,5836,9318,7860,9644,8941,6480,9443,8188,5928,161,6979,2352,5628,6991,1198,8067,5867,6620,3778,8426,2994,3122,3124,6335,3918,8897,2655,9670,634,1088,1576,8935,7255,474,8166,7417,9547,2886,5560,3842],
|
||||
[6957,3111,26,7530,7143,1295,1744,6057,3009,1854,8098,5405,2234,4874,9447,2620,9303,27,7410,969,40,2966,5648,7596,8637,4238,3143,3679,7187,690,9980,7085,7714,9373,5632,7526,6707,3951,9734,4216,2146,3602,5371,6029,3039,4433,4855,4151,1449,3376,8009,7240,7027,4602,2947,9081,4045,8424,9352,8742,923,2705,4266,3232,2264,6761,363,2651,3383,7770,6730,7856,7340,9679,2158,610,4471,4608,910,6241],
|
||||
[4417,6756,1013,8797,658,8809,5032,8703,7541,846,3357,2920,9817,1745,9980,7593,4667,3087,779,3218,6233,5568,4296,2289,2654,7898,5021,9461,5593,8214,9173,4203,2271,7980,2983,5952,9992,8399,3468,1776,3188,9314,1720,6523,2933,621,8685,5483,8986,6163,3444,9539,4320,155,3992,2828,2150,6071,524,2895,5468,8063,1210,3348,9071,4862,483,9017,4097,6186,9815,3610,5048,1644,1003,9865,9332,2145,1944,2213],
|
||||
[9284,3803,4920,1927,6706,4344,7383,4786,9890,2010,5228,1224,3158,6967,8580,8990,8883,5213,76,8306,2031,4980,5639,9519,7184,5645,7769,3259,8077,9130,1317,3096,9624,3818,1770,695,2454,947,6029,3474,9938,3527,5696,4760,7724,7738,2848,6442,5767,6845,8323,4131,2859,7595,2500,4815,3660,9130,8580,7016,8231,4391,8369,3444,4069,4021,556,6154,627,2778,1496,4206,6356,8434,8491,3816,8231,3190,5575,1015],
|
||||
[3787,7572,1788,6803,5641,6844,1961,4811,8535,9914,9999,1450,8857,738,4662,8569,6679,2225,7839,8618,286,2648,5342,2294,3205,4546,176,8705,3741,6134,8324,8021,7004,5205,7032,6637,9442,5539,5584,4819,5874,5807,8589,6871,9016,983,1758,3786,1519,6241,185,8398,495,3370,9133,3051,4549,9674,7311,9738,3316,9383,2658,2776,9481,7558,619,3943,3324,6491,4933,153,9738,4623,912,3595,7771,7939,1219,4405],
|
||||
[2650,3883,4154,5809,315,7756,4430,1788,4451,1631,6461,7230,6017,5751,138,588,5282,2442,9110,9035,6349,2515,1570,6122,4192,4174,3530,1933,4186,4420,4609,5739,4135,2963,6308,1161,8809,8619,2796,3819,6971,8228,4188,1492,909,8048,2328,6772,8467,7671,9068,2226,7579,6422,7056,8042,3296,2272,3006,2196,7320,3238,3490,3102,37,1293,3212,4767,5041,8773,5794,4456,6174,7279,7054,2835,7053,9088,790,6640],
|
||||
[3101,1057,7057,3826,6077,1025,2955,1224,1114,6729,5902,4698,6239,7203,9423,1804,4417,6686,1426,6941,8071,1029,4985,9010,6122,6597,1622,1574,3513,1684,7086,5505,3244,411,9638,4150,907,9135,829,981,1707,5359,8781,9751,5,9131,3973,7159,1340,6955,7514,7993,6964,8198,1933,2797,877,3993,4453,8020,9349,8646,2779,8679,2961,3547,3374,3510,1129,3568,2241,2625,9138,5974,8206,7669,7678,1833,8700,4480],
|
||||
[4865,9912,8038,8238,782,3095,8199,1127,4501,7280,2112,2487,3626,2790,9432,1475,6312,8277,4827,2218,5806,7132,8752,1468,7471,6386,739,8762,8323,8120,5169,9078,9058,3370,9560,7987,8585,8531,5347,9312,1058,4271,1159,5286,5404,6925,8606,9204,7361,2415,560,586,4002,2644,1927,2824,768,4409,2942,3345,1002,808,4941,6267,7979,5140,8643,7553,9438,7320,4938,2666,4609,2778,8158,6730,3748,3867,1866,7181],
|
||||
[171,3771,7134,8927,4778,2913,3326,2004,3089,7853,1378,1729,4777,2706,9578,1360,5693,3036,1851,7248,2403,2273,8536,6501,9216,613,9671,7131,7719,6425,773,717,8803,160,1114,7554,7197,753,4513,4322,8499,4533,2609,4226,8710,6627,644,9666,6260,4870,5744,7385,6542,6203,7703,6130,8944,5589,2262,6803,6381,7414,6888,5123,7320,9392,9061,6780,322,8975,7050,5089,1061,2260,3199,1150,1865,5386,9699,6501],
|
||||
[3744,8454,6885,8277,919,1923,4001,6864,7854,5519,2491,6057,8794,9645,1776,5714,9786,9281,7538,6916,3215,395,2501,9618,4835,8846,9708,2813,3303,1794,8309,7176,2206,1602,1838,236,4593,2245,8993,4017,10,8215,6921,5206,4023,5932,6997,7801,262,7640,3107,8275,4938,7822,2425,3223,3886,2105,8700,9526,2088,8662,8034,7004,5710,2124,7164,3574,6630,9980,4242,2901,9471,1491,2117,4562,1130,9086,4117,6698],
|
||||
[2810,2280,2331,1170,4554,4071,8387,1215,2274,9848,6738,1604,7281,8805,439,1298,8318,7834,9426,8603,6092,7944,1309,8828,303,3157,4638,4439,9175,1921,4695,7716,1494,1015,1772,5913,1127,1952,1950,8905,4064,9890,385,9357,7945,5035,7082,5369,4093,6546,5187,5637,2041,8946,1758,7111,6566,1027,1049,5148,7224,7248,296,6169,375,1656,7993,2816,3717,4279,4675,1609,3317,42,6201,3100,3144,163,9530,4531],
|
||||
[7096,6070,1009,4988,3538,5801,7149,3063,2324,2912,7911,7002,4338,7880,2481,7368,3516,2016,7556,2193,1388,3865,8125,4637,4096,8114,750,3144,1938,7002,9343,4095,1392,4220,3455,6969,9647,1321,9048,1996,1640,6626,1788,314,9578,6630,2813,6626,4981,9908,7024,4355,3201,3521,3864,3303,464,1923,595,9801,3391,8366,8084,9374,1041,8807,9085,1892,9431,8317,9016,9221,8574,9981,9240,5395,2009,6310,2854,9255],
|
||||
[8830,3145,2960,9615,8220,6061,3452,2918,6481,9278,2297,3385,6565,7066,7316,5682,107,7646,4466,68,1952,9603,8615,54,7191,791,6833,2560,693,9733,4168,570,9127,9537,1925,8287,5508,4297,8452,8795,6213,7994,2420,4208,524,5915,8602,8330,2651,8547,6156,1812,6271,7991,9407,9804,1553,6866,1128,2119,4691,9711,8315,5879,9935,6900,482,682,4126,1041,428,6247,3720,5882,7526,2582,4327,7725,3503,2631],
|
||||
[2738,9323,721,7434,1453,6294,2957,3786,5722,6019,8685,4386,3066,9057,6860,499,5315,3045,5194,7111,3137,9104,941,586,3066,755,4177,8819,7040,5309,3583,3897,4428,7788,4721,7249,6559,7324,825,7311,3760,6064,6070,9672,4882,584,1365,9739,9331,5783,2624,7889,1604,1303,1555,7125,8312,425,8936,3233,7724,1480,403,7440,1784,1754,4721,1569,652,3893,4574,5692,9730,4813,9844,8291,9199,7101,3391,8914],
|
||||
[6044,2928,9332,3328,8588,447,3830,1176,3523,2705,8365,6136,5442,9049,5526,8575,8869,9031,7280,706,2794,8814,5767,4241,7696,78,6570,556,5083,1426,4502,3336,9518,2292,1885,3740,3153,9348,9331,8051,2759,5407,9028,7840,9255,831,515,2612,9747,7435,8964,4971,2048,4900,5967,8271,1719,9670,2810,6777,1594,6367,6259,8316,3815,1689,6840,9437,4361,822,9619,3065,83,6344,7486,8657,8228,9635,6932,4864],
|
||||
[8478,4777,6334,4678,7476,4963,6735,3096,5860,1405,5127,7269,7793,4738,227,9168,2996,8928,765,733,1276,7677,6258,1528,9558,3329,302,8901,1422,8277,6340,645,9125,8869,5952,141,8141,1816,9635,4025,4184,3093,83,2344,2747,9352,7966,1206,1126,1826,218,7939,2957,2729,810,8752,5247,4174,4038,8884,7899,9567,301,5265,5752,7524,4381,1669,3106,8270,6228,6373,754,2547,4240,2313,5514,3022,1040,9738],
|
||||
[2265,8192,1763,1369,8469,8789,4836,52,1212,6690,5257,8918,6723,6319,378,4039,2421,8555,8184,9577,1432,7139,8078,5452,9628,7579,4161,7490,5159,8559,1011,81,478,5840,1964,1334,6875,8670,9900,739,1514,8692,522,9316,6955,1345,8132,2277,3193,9773,3923,4177,2183,1236,6747,6575,4874,6003,6409,8187,745,8776,9440,7543,9825,2582,7381,8147,7236,5185,7564,6125,218,7991,6394,391,7659,7456,5128,5294],
|
||||
[2132,8992,8160,5782,4420,3371,3798,5054,552,5631,7546,4716,1332,6486,7892,7441,4370,6231,4579,2121,8615,1145,9391,1524,1385,2400,9437,2454,7896,7467,2928,8400,3299,4025,7458,4703,7206,6358,792,6200,725,4275,4136,7390,5984,4502,7929,5085,8176,4600,119,3568,76,9363,6943,2248,9077,9731,6213,5817,6729,4190,3092,6910,759,2682,8380,1254,9604,3011,9291,5329,9453,9746,2739,6522,3765,5634,1113,5789],
|
||||
[5304,5499,564,2801,679,2653,1783,3608,7359,7797,3284,796,3222,437,7185,6135,8571,2778,7488,5746,678,6140,861,7750,803,9859,9918,2425,3734,2698,9005,4864,9818,6743,2475,132,9486,3825,5472,919,292,4411,7213,7699,6435,9019,6769,1388,802,2124,1345,8493,9487,8558,7061,8777,8833,2427,2238,5409,4957,8503,3171,7622,5779,6145,2417,5873,5563,5693,9574,9491,1937,7384,4563,6842,5432,2751,3406,7981]
|
||||
];
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,7 +7,8 @@ forumTopicId: 302198
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
In the game, Monopoly, the standard board is set up in the following way:
|
||||
|
||||
In the game, <i>Monopoly</i>, the standard board is set up in the following way:
|
||||
|
||||
<div style="text-align: center;">
|
||||
<table cellspacing="1" cellpadding="5" border="0" style="background-color: black; color: black;" align="center">
|
||||
@ -88,28 +89,41 @@ In the game, Monopoly, the standard board is set up in the following way:
|
||||
</div>
|
||||
|
||||
A player starts on the GO square and adds the scores on two 6-sided dice to determine the number of squares they advance in a clockwise direction. Without any further rules we would expect to visit each square with equal probability: 2.5%. However, landing on G2J (Go To Jail), CC (community chest), and CH (chance) changes this distribution.
|
||||
In addition to G2J, and one card from each of CC and CH, that orders the player to go directly to jail, if a player rolls three consecutive doubles, they do not advance the result of their 3rd roll. Instead they proceed directly to jail.
|
||||
At the beginning of the game, the CC and CH cards are shuffled. When a player lands on CC or CH they take a card from the top of the respective pile and, after following the instructions, it is returned to the bottom of the pile. There are sixteen cards in each pile, but for the purpose of this problem we are only concerned with cards that order a movement; any instruction not concerned with movement will be ignored and the player will remain on the CC/CH square.
|
||||
Community Chest (2/16 cards):
|
||||
Advance to GO
|
||||
Go to JAIL
|
||||
|
||||
Chance (10/16 cards):
|
||||
Advance to GO
|
||||
Go to JAIL
|
||||
Go to C1
|
||||
Go to E3
|
||||
Go to H2
|
||||
Go to R1
|
||||
Go to next R (railway company)
|
||||
Go to next R
|
||||
Go to next U (utility company)
|
||||
Go back 3 squares.
|
||||
In addition to G2J, and one card from each of CC and CH, that orders the player to go directly to jail, if a player rolls three consecutive doubles, they do not advance the result of their 3rd roll. Instead they proceed directly to jail.
|
||||
|
||||
At the beginning of the game, the CC and CH cards are shuffled. When a player lands on CC or CH they take a card from the top of the respective pile and, after following the instructions, it is returned to the bottom of the pile. There are sixteen cards in each pile, but for the purpose of this problem we are only concerned with cards that order a movement; any instruction not concerned with movement will be ignored and the player will remain on the CC/CH square.
|
||||
|
||||
<ul>
|
||||
<li>Community Chest (2/16 cards):</li>
|
||||
<ol>
|
||||
<li>Advance to GO</li>
|
||||
<li>Go to JAIL</li>
|
||||
</ol>
|
||||
|
||||
<li>Chance (10/16 cards):</li>
|
||||
<ol>
|
||||
<li>Advance to GO</li>
|
||||
<li>Go to JAIL</li>
|
||||
<li>Go to C1</li>
|
||||
<li>Go to E3</li>
|
||||
<li>Go to H2</li>
|
||||
<li>Go to R1</li>
|
||||
<li>Go to next R (railway company)</li>
|
||||
<li>Go to next R</li>
|
||||
<li>Go to next U (utility company)</li>
|
||||
<li>Go back 3 squares.</li>
|
||||
</ol>
|
||||
</ul>
|
||||
|
||||
The heart of this problem concerns the likelihood of visiting a particular square. That is, the probability of finishing at that square after a roll. For this reason it should be clear that, with the exception of G2J for which the probability of finishing on it is zero, the CH squares will have the lowest probabilities, as 5/8 request a movement to another square, and it is the final square that the player finishes at on each roll that we are interested in. We shall make no distinction between "Just Visiting" and being sent to JAIL, and we shall also ignore the rule about requiring a double to "get out of jail", assuming that they pay to get out on their next turn.
|
||||
|
||||
By starting at GO and numbering the squares sequentially from 00 to 39 we can concatenate these two-digit numbers to produce strings that correspond with sets of squares.
|
||||
|
||||
Statistically it can be shown that the three most popular squares, in order, are JAIL (6.24%) = Square 10, E3 (3.18%) = Square 24, and GO (3.09%) = Square 00. So these three most popular squares can be listed with the six-digit modal string: 102400.
|
||||
|
||||
If, instead of using two 6-sided dice, two 4-sided dice are used, find the six-digit modal string.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -122,8 +136,10 @@ If, instead of using two 6-sided dice, two 4-sided dice are used, find the six-d
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler84()</code> should return 101524.
|
||||
testString: assert.strictEqual(euler84(), 101524);
|
||||
- text: <code>monopolyOdds()</code> should return a number.
|
||||
testString: assert(typeof monopolyOdds() === 'number');
|
||||
- text: <code>monopolyOdds()</code> should return 101524.
|
||||
testString: assert.strictEqual(monopolyOdds(), 101524);
|
||||
|
||||
```
|
||||
|
||||
@ -135,12 +151,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler84() {
|
||||
function monopolyOdds() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler84();
|
||||
monopolyOdds();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,10 +7,13 @@ forumTopicId: 302199
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of the different rectangles found within a 3 by 2 rectangular grid" src="https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,8 +26,10 @@ Although there exists no rectangular grid that contains exactly two million rect
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler85()</code> should return 2772.
|
||||
testString: assert.strictEqual(euler85(), 2772);
|
||||
- text: <code>countingRectangles()</code> should return a number.
|
||||
testString: assert(typeof countingRectangles() === 'number');
|
||||
- text: <code>countingRectangles()</code> should return 2772.
|
||||
testString: assert.strictEqual(countingRectangles(), 2772);
|
||||
|
||||
```
|
||||
|
||||
@ -36,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler85() {
|
||||
function countingRectangles() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler85();
|
||||
countingRectangles();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,12 +7,17 @@ forumTopicId: 302200
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner. By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram.
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner" src="https://cdn-media-1.freecodecamp.org/project-euler/cuboid-route.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.
|
||||
|
||||
It can be shown that there are exactly 2060 distinct cuboids, ignoring rotations, with integer dimensions, up to a maximum size of M by M by M, for which the shortest route has integer length when M = 100. This is the least value of M for which the number of solutions first exceeds two thousand; the number of solutions when M = 99 is 1975.
|
||||
|
||||
Find the least value of M such that the number of solutions first exceeds one million.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,8 +30,10 @@ Find the least value of M such that the number of solutions first exceeds one mi
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler86()</code> should return 1818.
|
||||
testString: assert.strictEqual(euler86(), 1818);
|
||||
- text: <code>cuboidRoute()</code> should return a number.
|
||||
testString: assert(typeof cuboidRoute() === 'number');
|
||||
- text: <code>cuboidRoute()</code> should return 1818.
|
||||
testString: assert.strictEqual(cuboidRoute(), 1818);
|
||||
|
||||
```
|
||||
|
||||
@ -38,12 +45,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler86() {
|
||||
function cuboidRoute() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler86();
|
||||
cuboidRoute();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,12 +7,18 @@ forumTopicId: 302201
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The smallest number expressible as the sum of a prime square, prime cube, and prime fourth power is 28. In fact, there are exactly four numbers below fifty that can be expressed in such a way:
|
||||
28 = 22 + 23 + 24
|
||||
33 = 32 + 23 + 24
|
||||
49 = 52 + 23 + 24
|
||||
47 = 22 + 33 + 24
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
28 = 2<sup>2</sup> + 2<sup>3</sup> + 2<sup>4</sup><br>
|
||||
33 = 3<sup>2</sup> + 2<sup>3</sup> + 2<sup>4</sup><br>
|
||||
49 = 5<sup>2</sup> + 2<sup>3</sup> + 2<sup>4</sup><br>
|
||||
47 = 2<sup>2</sup> + 3<sup>3</sup> + 2<sup>4</sup>
|
||||
</div>
|
||||
|
||||
How many numbers below fifty million can be expressed as the sum of a prime square, prime cube, and prime fourth power?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,8 +31,10 @@ How many numbers below fifty million can be expressed as the sum of a prime squa
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler87()</code> should return 1097343.
|
||||
testString: assert.strictEqual(euler87(), 1097343);
|
||||
- text: <code>primePowerTriples()</code> should return a number.
|
||||
testString: assert(typeof primePowerTriples() === 'number');
|
||||
- text: <code>primePowerTriples()</code> should return 1097343.
|
||||
testString: assert.strictEqual(primePowerTriples(), 1097343);
|
||||
|
||||
```
|
||||
|
||||
@ -38,12 +46,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler87() {
|
||||
function primePowerTriples() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler87();
|
||||
primePowerTriples();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,13 +7,27 @@ forumTopicId: 302203
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {a1, a2, ... , ak} is called a product-sum number: N = a1 + a2 + ... + ak = a1 × a2 × ... × ak.
|
||||
|
||||
A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {<var>a</var><sub>1</sub>, <var>a</var><sub>2</sub>, ... , <var>a</var><sub>k</sub>} is called a product-sum number: N = <var>a</var><sub>1</sub> + <var>a</var><sub>2</sub> + ... + <var>a</var><sub>k</sub> = <var>a</var><sub>1</sub> × <var>a</var><sub>2</sub> × ... × <var>a</var><sub>k</sub>.
|
||||
|
||||
For example, 6 = 1 + 2 + 3 = 1 × 2 × 3.
|
||||
For a given set of size, k, we shall call the smallest N with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, k = 2, 3, 4, 5, and 6 are as follows.
|
||||
k=2: 4 = 2 × 2 = 2 + 2k=3: 6 = 1 × 2 × 3 = 1 + 2 + 3k=4: 8 = 1 × 1 × 2 × 4 = 1 + 1 + 2 + 4k=5: 8 = 1 × 1 × 2 × 2 × 2 = 1 + 1 + 2 + 2 + 2k=6: 12 = 1 × 1 × 1 × 1 × 2 × 6 = 1 + 1 + 1 + 1 + 2 + 6
|
||||
Hence for 2≤k≤6, the sum of all the minimal product-sum numbers is 4+6+8+12 = 30; note that 8 is only counted once in the sum.
|
||||
In fact, as the complete set of minimal product-sum numbers for 2≤k≤12 is {4, 6, 8, 12, 15, 16}, the sum is 61.
|
||||
What is the sum of all the minimal product-sum numbers for 2≤k≤12000?
|
||||
|
||||
For a given set of size, <var>k</var>, we shall call the smallest N with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, <var>k</var> = 2, 3, 4, 5, and 6 are as follows.
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
<var>k</var>=2: 4 = 2 × 2 = 2 + 2<br>
|
||||
<var>k</var>=3: 6 = 1 × 2 × 3 = 1 + 2 + 3<br>
|
||||
<var>k</var>=4: 8 = 1 × 1 × 2 × 4 = 1 + 1 + 2 + 4<br>
|
||||
<var>k</var>=5: 8 = 1 × 1 × 2 × 2 × 2 = 1 + 1 + 2 + 2 + 2<br>
|
||||
<var>k</var>=6: 12 = 1 × 1 × 1 × 1 × 2 × 6 = 1 + 1 + 1 + 1 + 2 + 6
|
||||
</div>
|
||||
|
||||
Hence for 2≤<var>k</var>≤6, the sum of all the minimal product-sum numbers is 4+6+8+12 = 30; note that 8 is only counted once in the sum.
|
||||
|
||||
In fact, as the complete set of minimal product-sum numbers for 2≤<var>k</var>≤12 is {4, 6, 8, 12, 15, 16}, the sum is 61.
|
||||
|
||||
What is the sum of all the minimal product-sum numbers for 2≤<var>k</var>≤12000?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -26,8 +40,10 @@ What is the sum of all the minimal product-sum numbers for 2≤k≤12000?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler88()</code> should return 7587457.
|
||||
testString: assert.strictEqual(euler88(), 7587457);
|
||||
- text: <code>productSumNumbers()</code> should return a number.
|
||||
testString: assert(typeof productSumNumbers() === 'number');
|
||||
- text: <code>productSumNumbers()</code> should return 7587457.
|
||||
testString: assert.strictEqual(productSumNumbers(), 7587457);
|
||||
|
||||
```
|
||||
|
||||
@ -39,12 +55,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler88() {
|
||||
function productSumNumbers() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler88();
|
||||
productSumNumbers();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -7,10 +7,15 @@ forumTopicId: 302205
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A Pythagorean triplet is a set of three natural numbers, <var>a</var> < <var>b</var> < <var>c</var>, for which,
|
||||
|
||||
<div style='text-align: center;'><var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup></div>
|
||||
|
||||
For example, 3<sup>2</sup> + 4<sup>2</sup> = 9 + 16 = 25 = 5<sup>2</sup>.
|
||||
There exists exactly one Pythagorean triplet for which <var>a</var> + <var>b</var> + <var>c</var> = 1000. Find the product <var>abc</var> such that <var>a</var> + <var>b</var> + <var>c</var> = <code>n</code>.
|
||||
|
||||
There exists exactly one Pythagorean triplet for which <var>a</var> + <var>b</var> + <var>c</var> = 1000. Find the product <var>abc</var> such that <var>a</var> + <var>b</var> + <var>c</var> = `n`.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -23,12 +28,14 @@ There exists exactly one Pythagorean triplet for which <var>a</var> + <var>b</va
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>specialPythagoreanTriplet(1000)</code> should return 31875000.
|
||||
testString: assert.strictEqual(specialPythagoreanTriplet(1000), 31875000);
|
||||
- text: <code>specialPythagoreanTriplet(24)</code> should return a number.
|
||||
testString: assert(typeof specialPythagoreanTriplet(24) === 'number');
|
||||
- text: <code>specialPythagoreanTriplet(24)</code> should return 480.
|
||||
testString: assert.strictEqual(specialPythagoreanTriplet(24), 480);
|
||||
- text: <code>specialPythagoreanTriplet(120)</code> should return 49920, 55080 or 60000
|
||||
testString: assert([49920, 55080, 60000].includes(specialPythagoreanTriplet(120)));
|
||||
- text: <code>specialPythagoreanTriplet(1000)</code> should return 31875000.
|
||||
testString: assert.strictEqual(specialPythagoreanTriplet(1000), 31875000);
|
||||
|
||||
```
|
||||
|
||||
|
@ -7,12 +7,12 @@ forumTopicId: 302207
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
Each of the six faces on a cube has a different digit (0 to 9) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can form a variety of 2-digit numbers.
|
||||
|
||||
For example, the square number 64 could be formed:
|
||||
|
||||
|
||||
|
||||
<img class="img-responsive center-block" alt="two cubes, one with the number 6 and the other with number 4" src="https://cdn-media-1.freecodecamp.org/project-euler/cube-digit-pairs.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: 01, 04, 09, 16, 25, 36, 49, 64, and 81.
|
||||
|
||||
@ -22,12 +22,15 @@ However, for this problem we shall allow the 6 or 9 to be turned upside-down so
|
||||
|
||||
In determining a distinct arrangement we are interested in the digits on each cube, not the order.
|
||||
|
||||
{1, 2, 3, 4, 5, 6} is equivalent to {3, 6, 4, 1, 2, 5}
|
||||
{1, 2, 3, 4, 5, 6} is distinct from {1, 2, 3, 4, 5, 9}
|
||||
<div style="margin-left: 4em;">
|
||||
{1, 2, 3, 4, 5, 6} is equivalent to {3, 6, 4, 1, 2, 5}<br>
|
||||
{1, 2, 3, 4, 5, 6} is distinct from {1, 2, 3, 4, 5, 9}
|
||||
</div>
|
||||
|
||||
But because we are allowing 6 and 9 to be reversed, the two distinct sets in the last example both represent the extended set {1, 2, 3, 4, 5, 6, 9} for the purpose of forming 2-digit numbers.
|
||||
|
||||
How many distinct arrangements of the two cubes allow for all of the square numbers to be displayed?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -40,8 +43,10 @@ How many distinct arrangements of the two cubes allow for all of the square numb
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler90()</code> should return 1217.
|
||||
testString: assert.strictEqual(euler90(), 1217);
|
||||
- text: <code>cubeDigitPairs()</code> should return a number.
|
||||
testString: assert(typeof cubeDigitPairs() === 'number');
|
||||
- text: <code>cubeDigitPairs()</code> should return 1217.
|
||||
testString: assert.strictEqual(cubeDigitPairs(), 1217);
|
||||
|
||||
```
|
||||
|
||||
@ -53,12 +58,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler90() {
|
||||
function cubeDigitPairs() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler90();
|
||||
cubeDigitPairs();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,17 +7,17 @@ forumTopicId: 302208
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The points P (x1, y1) and Q (x2, y2) are plotted at integer coordinates and are joined to the origin, O(0,0), to form ΔOPQ.
|
||||
|
||||
The points P (<var>x</var><sub>1</sub>, <var>y</var><sub>1</sub>) and Q (<var>x</var><sub>2</sub>, <var>y</var><sub>2</sub>) are plotted at integer co-ordinates and are joined to the origin, O(0,0), to form ΔOPQ.
|
||||
|
||||
<img class="img-responsive center-block" alt="a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0)" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-1.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is, 0 ≤ <var>x</var><sub>1</sub>, <var>y</var><sub>1</sub>, <var>x</var><sub>2</sub>, <var>y</var><sub>2</sub> ≤ 2.
|
||||
|
||||
There are exactly fourteen triangles containing a right angle that can be formed when each coordinate lies between 0 and 2 inclusive; that is,0 ≤ x1, y1, x2, y2 ≤ 2.
|
||||
<img class="img-responsive center-block" alt="a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-2.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
Given that 0 ≤ <var>x</var><sub>1</sub>, <var>y</var><sub>1</sub>, <var>x</var><sub>2</sub>, <var>y</var><sub>2</sub> ≤ 50, how many right triangles can be formed?
|
||||
|
||||
|
||||
|
||||
Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed?
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -30,8 +30,10 @@ Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler91()</code> should return 14234.
|
||||
testString: assert.strictEqual(euler91(), 14234);
|
||||
- text: <code>rightTrianglesIntCoords()</code> should return a number.
|
||||
testString: assert(typeof rightTrianglesIntCoords() === 'number');
|
||||
- text: <code>rightTrianglesIntCoords()</code> should return 14234.
|
||||
testString: assert.strictEqual(rightTrianglesIntCoords(), 14234);
|
||||
|
||||
```
|
||||
|
||||
@ -43,12 +45,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler91() {
|
||||
function rightTrianglesIntCoords() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler91();
|
||||
rightTrianglesIntCoords();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,12 +7,20 @@ forumTopicId: 302209
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
A number chain is created by continuously adding the square of the digits in a number to form a new number until it has been seen before.
|
||||
|
||||
For example,
|
||||
44 → 32 → 13 → 10 → 1 → 1
|
||||
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
44 → 32 → 13 → 10 → <strong>1</strong> → <strong>1</strong><br>
|
||||
85 → <strong>89</strong> → 145 → 42 → 20 → 4 → 16 → 37 → 58 → <strong>89</strong>
|
||||
</div>
|
||||
|
||||
Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is most amazing is that EVERY starting number will eventually arrive at 1 or 89.
|
||||
|
||||
How many starting numbers below ten million will arrive at 89?
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,8 +33,10 @@ How many starting numbers below ten million will arrive at 89?
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler92()</code> should return 8581146.
|
||||
testString: assert.strictEqual(euler92(), 8581146);
|
||||
- text: <code>squareDigitChains()</code> should return a number.
|
||||
testString: assert(typeof squareDigitChains() === 'number');
|
||||
- text: <code>squareDigitChains()</code> should return 8581146.
|
||||
testString: assert.strictEqual(squareDigitChains(), 8581146);
|
||||
|
||||
```
|
||||
|
||||
@ -38,12 +48,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler92() {
|
||||
function squareDigitChains() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler92();
|
||||
squareDigitChains();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,15 +7,24 @@ forumTopicId: 302210
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
By using each of the digits from the set, {1, 2, 3, 4}, exactly once, and making use of the four arithmetic operations (+, −, *, /) and brackets/parentheses, it is possible to form different positive integer targets.
|
||||
|
||||
For example,
|
||||
8 = (4 * (1 + 3)) / 2
|
||||
14 = 4 * (3 + 1 / 2)
|
||||
19 = 4 * (2 + 3) − 1
|
||||
36 = 3 * 4 * (2 + 1)
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
8 = (4 * (1 + 3)) / 2<br>
|
||||
14 = 4 * (3 + 1 / 2)<br>
|
||||
19 = 4 * (2 + 3) − 1<br>
|
||||
36 = 3 * 4 * (2 + 1)
|
||||
</div>
|
||||
|
||||
Note that concatenations of the digits, like 12 + 34, are not allowed.
|
||||
|
||||
Using the set, {1, 2, 3, 4}, it is possible to obtain thirty-one different target numbers of which 36 is the maximum, and each of the numbers 1 to 28 can be obtained before encountering the first non-expressible number.
|
||||
Find the set of four distinct digits, a < b < c < d, for which the longest set of consecutive positive integers, 1 to n, can be obtained, giving your answer as a string: abcd.
|
||||
|
||||
Find the set of four distinct digits, <var>a</var> < <var>b</var> < <var>c</var> < <var>d</var>, for which the longest set of consecutive positive integers, 1 to <var>n</var>, can be obtained, giving your answer as a string: <var>abcd</var>.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -28,8 +37,10 @@ Find the set of four distinct digits, a < b < c < d, for which the longest set o
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler93()</code> should return 1258.
|
||||
testString: assert.strictEqual(euler93(), 1258);
|
||||
- text: <code>arithmeticExpressions()</code> should return a number.
|
||||
testString: assert(typeof arithmeticExpressions() === 'number');
|
||||
- text: <code>arithmeticExpressions()</code> should return 1258.
|
||||
testString: assert.strictEqual(arithmeticExpressions(), 1258);
|
||||
|
||||
```
|
||||
|
||||
@ -41,12 +52,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler93() {
|
||||
function arithmeticExpressions() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler93();
|
||||
arithmeticExpressions();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302211
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the almost equilateral triangle 5-5-6 has an area of 12 square units.
|
||||
We shall define an almost equilateral triangle to be a triangle for which two sides are equal and the third differs by no more than one unit.
|
||||
Find the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed one billion (1,000,000,000).
|
||||
|
||||
It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the <dfn>almost equilateral triangle</dfn> 5-5-6 has an area of 12 square units.
|
||||
|
||||
We shall define an <dfn>almost equilateral triangle</dfn> to be a triangle for which two sides are equal and the third differs by no more than one unit.
|
||||
|
||||
Find the sum of the perimeters of all <dfn>almost equilateral triangle</dfn> with integral side lengths and area and whose perimeters do not exceed one billion (1,000,000,000).
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ Find the sum of the perimeters of all almost equilateral triangles with integral
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler94()</code> should return 518408346.
|
||||
testString: assert.strictEqual(euler94(), 518408346);
|
||||
- text: <code>almostEquilateralTriangles()</code> should return a number.
|
||||
testString: assert(typeof almostEquilateralTriangles() === 'number');
|
||||
- text: <code>almostEquilateralTriangles()</code> should return 518408346.
|
||||
testString: assert.strictEqual(almostEquilateralTriangles(), 518408346);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler94() {
|
||||
function almostEquilateralTriangles() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler94();
|
||||
almostEquilateralTriangles();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,12 +7,21 @@ forumTopicId: 302212
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
|
||||
The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of 28 are 1, 2, 4, 7, and 14. As the sum of these divisors is equal to 28, we call it a perfect number.
|
||||
|
||||
Interestingly the sum of the proper divisors of 220 is 284 and the sum of the proper divisors of 284 is 220, forming a chain of two numbers. For this reason, 220 and 284 are called an amicable pair.
|
||||
|
||||
Perhaps less well known are longer chains. For example, starting with 12496, we form a chain of five numbers:
|
||||
12496 → 14288 → 15472 → 14536 → 14264 (→ 12496 → ...)
|
||||
|
||||
<div style="text-align: center;">
|
||||
12496 → 14288 → 15472 → 14536 → 14264 (→ 12496 → ...)
|
||||
</div>
|
||||
|
||||
Since this chain returns to its starting point, it is called an amicable chain.
|
||||
|
||||
Find the smallest member of the longest amicable chain with no element exceeding one million.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -25,8 +34,10 @@ Find the smallest member of the longest amicable chain with no element exceeding
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler95()</code> should return 14316.
|
||||
testString: assert.strictEqual(euler95(), 14316);
|
||||
- text: <code>amicableChains()</code> should return a number.
|
||||
testString: assert(typeof amicableChains() === 'number');
|
||||
- text: <code>amicableChains()</code> should return 14316.
|
||||
testString: assert.strictEqual(amicableChains(), 14316);
|
||||
|
||||
```
|
||||
|
||||
@ -38,12 +49,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler95() {
|
||||
function amicableChains() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler95();
|
||||
amicableChains();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,8 +7,8 @@ forumTopicId: 302213
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
Su Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
|
||||
|
||||
Su Doku (Japanese meaning <i>number place</i>) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
|
||||
|
||||
<div style="margin: auto; background-color: white; padding: 10px; width: 80%; text-align: center;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" align="center">
|
||||
@ -101,8 +101,11 @@ Su Doku (Japanese meaning number place) is the name given to a popular puzzle co
|
||||
</div>
|
||||
|
||||
A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.
|
||||
The 6K text file, sudoku.txt (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).
|
||||
|
||||
The `puzzlesArr` array contains fifty different Su Doku puzzle strings ranging in difficulty, but all with unique solutions (the first puzzle in the array is the example in the challenge description).
|
||||
|
||||
By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -115,8 +118,12 @@ By solving all fifty puzzles find the sum of the 3-digit numbers found in the to
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler96()</code> should return 24702.
|
||||
testString: assert.strictEqual(euler96(), 24702);
|
||||
- text: <code>suDoku(testPuzzles)</code> should return a number.
|
||||
testString: assert(typeof suDoku(testPuzzles) === 'number');
|
||||
- text: <code>suDoku(testPuzzles)</code> should return 1190.
|
||||
testString: assert.strictEqual(suDoku(testPuzzles), 1190);
|
||||
- text: <code>suDoku(puzzlesArr)</code> should return 24702.
|
||||
testString: assert.strictEqual(suDoku(puzzlesArr), 24702);
|
||||
|
||||
```
|
||||
|
||||
@ -128,12 +135,73 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler96() {
|
||||
function suDoku(arr) {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler96();
|
||||
// Only change code above this line
|
||||
|
||||
const testPuzzles = [
|
||||
'003020600900305001001806400008102900700000008006708200002609500800203009005010300',
|
||||
'200080300060070084030500209000105408000000000402706000301007040720040060004010003',
|
||||
'000000907000420180000705026100904000050000040000507009920108000034059000507000000'
|
||||
];
|
||||
|
||||
const puzzlesArr = [
|
||||
'003020600900305001001806400008102900700000008006708200002609500800203009005010300',
|
||||
'200080300060070084030500209000105408000000000402706000301007040720040060004010003',
|
||||
'000000907000420180000705026100904000050000040000507009920108000034059000507000000',
|
||||
'030050040008010500460000012070502080000603000040109030250000098001020600080060020',
|
||||
'020810740700003100090002805009040087400208003160030200302700060005600008076051090',
|
||||
'100920000524010000000000070050008102000000000402700090060000000000030945000071006',
|
||||
'043080250600000000000001094900004070000608000010200003820500000000000005034090710',
|
||||
'480006902002008001900370060840010200003704100001060049020085007700900600609200018',
|
||||
'000900002050123400030000160908000000070000090000000205091000050007439020400007000',
|
||||
'001900003900700160030005007050000009004302600200000070600100030042007006500006800',
|
||||
'000125400008400000420800000030000095060902010510000060000003049000007200001298000',
|
||||
'062340750100005600570000040000094800400000006005830000030000091006400007059083260',
|
||||
'300000000005009000200504000020000700160000058704310600000890100000067080000005437',
|
||||
'630000000000500008005674000000020000003401020000000345000007004080300902947100080',
|
||||
'000020040008035000000070602031046970200000000000501203049000730000000010800004000',
|
||||
'361025900080960010400000057008000471000603000259000800740000005020018060005470329',
|
||||
'050807020600010090702540006070020301504000908103080070900076205060090003080103040',
|
||||
'080005000000003457000070809060400903007010500408007020901020000842300000000100080',
|
||||
'003502900000040000106000305900251008070408030800763001308000104000020000005104800',
|
||||
'000000000009805100051907420290401065000000000140508093026709580005103600000000000',
|
||||
'020030090000907000900208005004806500607000208003102900800605007000309000030020050',
|
||||
'005000006070009020000500107804150000000803000000092805907006000030400010200000600',
|
||||
'040000050001943600009000300600050002103000506800020007005000200002436700030000040',
|
||||
'004000000000030002390700080400009001209801307600200008010008053900040000000000800',
|
||||
'360020089000361000000000000803000602400603007607000108000000000000418000970030014',
|
||||
'500400060009000800640020000000001008208000501700500000000090084003000600060003002',
|
||||
'007256400400000005010030060000508000008060200000107000030070090200000004006312700',
|
||||
'000000000079050180800000007007306800450708096003502700700000005016030420000000000',
|
||||
'030000080009000500007509200700105008020090030900402001004207100002000800070000090',
|
||||
'200170603050000100000006079000040700000801000009050000310400000005000060906037002',
|
||||
'000000080800701040040020030374000900000030000005000321010060050050802006080000000',
|
||||
'000000085000210009960080100500800016000000000890006007009070052300054000480000000',
|
||||
'608070502050608070002000300500090006040302050800050003005000200010704090409060701',
|
||||
'050010040107000602000905000208030501040070020901080406000401000304000709020060010',
|
||||
'053000790009753400100000002090080010000907000080030070500000003007641200061000940',
|
||||
'006080300049070250000405000600317004007000800100826009000702000075040190003090600',
|
||||
'005080700700204005320000084060105040008000500070803010450000091600508007003010600',
|
||||
'000900800128006400070800060800430007500000009600079008090004010003600284001007000',
|
||||
'000080000270000054095000810009806400020403060006905100017000620460000038000090000',
|
||||
'000602000400050001085010620038206710000000000019407350026040530900020007000809000',
|
||||
'000900002050123400030000160908000000070000090000000205091000050007439020400007000',
|
||||
'380000000000400785009020300060090000800302009000040070001070500495006000000000092',
|
||||
'000158000002060800030000040027030510000000000046080790050000080004070100000325000',
|
||||
'010500200900001000002008030500030007008000500600080004040100700000700006003004050',
|
||||
'080000040000469000400000007005904600070608030008502100900000005000781000060000010',
|
||||
'904200007010000000000706500000800090020904060040002000001607000000000030300005702',
|
||||
'000700800006000031040002000024070000010030080000060290000800070860000500002006000',
|
||||
'001007090590080001030000080000005800050060020004100000080000030100020079020700400',
|
||||
'000003017015009008060000000100007000009000200000500004000000020500600340340200000',
|
||||
'300200000000107000706030500070009080900020004010800050009040301000702000000008006'
|
||||
];
|
||||
|
||||
suDoku(testPuzzles);
|
||||
```
|
||||
|
||||
</div>
|
||||
|
@ -7,9 +7,13 @@ forumTopicId: 302214
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
The first known prime found to exceed one million digits was discovered in 1999, and is a Mersenne prime of the form 26972593−1; it contains exactly 2,098,960 digits. Subsequently other Mersenne primes, of the form 2p−1, have been found which contain more digits.
|
||||
However, in 2004 there was found a massive non-Mersenne prime which contains 2,357,207 digits: 28433×27830457+1.
|
||||
|
||||
The first known prime found to exceed one million digits was discovered in 1999, and is a Mersenne prime of the form 2<sup>6972593</sup>−1; it contains exactly 2,098,960 digits. Subsequently other Mersenne primes, of the form 2<sup><var>p</var></sup>−1, have been found which contain more digits.
|
||||
|
||||
However, in 2004 there was found a massive non-Mersenne prime which contains 2,357,207 digits: 28433×2<sup>7830457</sup>+1.
|
||||
|
||||
Find the last ten digits of this prime number.
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
@ -22,8 +26,10 @@ Find the last ten digits of this prime number.
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>euler97()</code> should return 8739992577.
|
||||
testString: assert.strictEqual(euler97(), 8739992577);
|
||||
- text: <code>lrgNonMersennePrime()</code> should return a number.
|
||||
testString: assert(typeof lrgNonMersennePrime() === 'number');
|
||||
- text: <code>lrgNonMersennePrime()</code> should return 8739992577.
|
||||
testString: assert.strictEqual(lrgNonMersennePrime(), 8739992577);
|
||||
|
||||
```
|
||||
|
||||
@ -35,12 +41,12 @@ tests:
|
||||
<div id='js-seed'>
|
||||
|
||||
```js
|
||||
function euler97() {
|
||||
function lrgNonMersennePrime() {
|
||||
// Good luck!
|
||||
return true;
|
||||
}
|
||||
|
||||
euler97();
|
||||
lrgNonMersennePrime();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user