diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5.english.md index 59eacc5284..3daca99855 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5.english.md @@ -7,8 +7,11 @@ forumTopicId: 301722 ## 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 number. + +Find the sum of all the multiples of 3 or 5 below the provided parameter value `number`. +
## Instructions @@ -21,14 +24,16 @@ Find the sum of all the multiples of 3 or 5 below the provided parameter value < ```yml tests: - - text: multiplesOf3and5(1000) should return 233168. - testString: assert.strictEqual(multiplesOf3and5(1000), 233168); + - text: multiplesOf3and5(10) should return a number. + testString: assert(typeof multiplesOf3and5(10) === 'number'); - text: multiplesOf3and5(49) should return 543. testString: assert.strictEqual(multiplesOf3and5(49), 543); - - text: multiplesOf3and5(19564) should return 89301183. - testString: assert.strictEqual(multiplesOf3and5(19564), 89301183); + - text: multiplesOf3and5(1000) should return 233168. + testString: assert.strictEqual(multiplesOf3and5(1000), 233168); - text: multiplesOf3and5(8456) should return 16687353. testString: assert.strictEqual(multiplesOf3and5(8456), 16687353); + - text: multiplesOf3and5(19564) should return 89301183. + testString: assert.strictEqual(multiplesOf3and5(19564), 89301183); ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-10-summation-of-primes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-10-summation-of-primes.english.md index 30e8989ff3..69f8c25ddf 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-10-summation-of-primes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-10-summation-of-primes.english.md @@ -7,8 +7,11 @@ forumTopicId: 301723 ## 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`. +
## Instructions @@ -21,6 +24,8 @@ Find the sum of all the primes below n. ```yml tests: + - text: primeSummation(17) should return a number. + testString: assert(typeof primeSummation(17) === 'number'); - text: primeSummation(17) should return 41. testString: assert.strictEqual(primeSummation(17), 41); - text: primeSummation(2001) should return 277050. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-100-arranged-probability.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-100-arranged-probability.english.md index 00ee5943af..5a31d92450 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-100-arranged-probability.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-100-arranged-probability.english.md @@ -7,9 +7,13 @@ forumTopicId: 301724 ## 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 1012 = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain. +
## Instructions @@ -22,8 +26,10 @@ By finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs ```yml tests: - - text: euler100() should return 756872327473. - testString: assert.strictEqual(euler100(), 756872327473); + - text: arrangedProbability() should return a number. + testString: assert(typeof arrangedProbability() === 'number'); + - text: arrangedProbability() should return 756872327473. + testString: assert.strictEqual(arrangedProbability(), 756872327473); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler100() { +function arrangedProbability() { // Good luck! return true; } -euler100(); +arrangedProbability(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-11-largest-product-in-a-grid.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-11-largest-product-in-a-grid.english.md index 38de8a8b97..4af45aa659 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-11-largest-product-in-a-grid.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-11-largest-product-in-a-grid.english.md @@ -7,31 +7,36 @@ forumTopicId: 301734 ## Description
+ In the 20×20 grid below, four numbers along a diagonal line have been marked in red. -
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
-
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
-
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
-
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
-
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
-
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
-
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
-
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
-
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
-
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
-
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
-
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
-
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
-
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
-
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
-
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
-
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
-
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
-
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
-
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
+
+ 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
+ 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
+ 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
+ 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
+ 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
+ 24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
+ 32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
+ 67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
+ 24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
+ 21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
+ 78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
+ 16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
+ 86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
+ 19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
+ 04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
+ 88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
+ 04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
+ 20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
+ 20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
+ 01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
+
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 arr 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? +
## Instructions @@ -44,10 +49,12 @@ What is the greatest product of four adjacent numbers in the same direction (up, ```yml tests: - - text: largestGridProduct(grid) should return 70600674. - testString: assert.strictEqual(largestGridProduct(grid), 70600674); + - text: largestGridProduct(testGrid) should return a number. + testString: assert(typeof largestGridProduct(testGrid) === 'number'); - text: largestGridProduct(testGrid) should return 14169081. testString: assert.strictEqual(largestGridProduct(testGrid), 14169081); + - text: largestGridProduct(grid) 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 diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-12-highly-divisible-triangular-number.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-12-highly-divisible-triangular-number.english.md index ec923be79e..95b33c789a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-12-highly-divisible-triangular-number.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-12-highly-divisible-triangular-number.english.md @@ -7,9 +7,13 @@ forumTopicId: 301746 ## 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: +
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
+ Let us list the factors of the first seven triangle numbers: +
1: 1
3: 1, 3
6: 1, 2, 3, 6
@@ -17,8 +21,11 @@ Let us list the factors of the first seven triangle numbers:
15: 1, 3, 5, 15
21: 1, 3, 7, 21
28: 1, 2, 4, 7, 14, 28
+ 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 n divisors? + +What is the value of the first triangle number to have over `n` divisors? +
## Instructions @@ -31,6 +38,8 @@ What is the value of the first triangle number to have over n divis ```yml tests: + - text: divisibleTriangleNumber(5) should return a number. + testString: assert(typeof divisibleTriangleNumber(5) === 'number'); - text: divisibleTriangleNumber(5) should return 28. testString: assert.strictEqual(divisibleTriangleNumber(5), 28); - text: divisibleTriangleNumber(23) should return 630. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-13-large-sum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-13-large-sum.english.md index 0c855c1207..a72f23b3e3 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-13-large-sum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-13-large-sum.english.md @@ -7,108 +7,112 @@ forumTopicId: 301757 ## 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 +
+ 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
+
+
## 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: largeSum(testNums) should return a number. + testString: assert(typeof largeSum(testNums) === 'number'); - text: largeSum(testNums) should return 8348422521. testString: assert.strictEqual(largeSum(testNums), 8348422521); - text: largeSum(fiftyDigitNums) 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', diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.english.md index 3d6ad37cbe..4ae420e75a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-14-longest-collatz-sequence.english.md @@ -7,14 +7,23 @@ forumTopicId: 301768 ## Description
+ The following iterative sequence is defined for the set of positive integers: +
nn/2 (n is even)
+
n → 3n + 1 (n is odd)
+ Using the rule above and starting with 13, we generate the following sequence: +
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1
+ 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 limit, 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. +
## Instructions @@ -27,6 +36,8 @@ NOTE: Once the chain starts the terms are allowed to go above one million. ```yml tests: + - text: longestCollatzSequence(14) should return a number. + testString: assert(typeof longestCollatzSequence(14) === 'number'); - text: longestCollatzSequence(14) should return 9. testString: assert.strictEqual(longestCollatzSequence(14), 9); - text: longestCollatzSequence(5847) should return 3711. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-15-lattice-paths.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-15-lattice-paths.english.md index 9582149887..c65d88df61 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-15-lattice-paths.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-15-lattice-paths.english.md @@ -7,11 +7,13 @@ forumTopicId: 301780 ## 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. -a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner +a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner + +How many such routes are there through a given `gridSize`? -How many such routes are there through a given gridSize?
## Instructions @@ -24,6 +26,8 @@ How many such routes are there through a given gridSize? ```yml tests: + - text: latticePaths(4) should return a number. + testString: assert(typeof latticePaths(4) === 'number'); - text: latticePaths(4) should return 70. testString: assert.strictEqual(latticePaths(4), 70); - text: latticePaths(9) should return 48620. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-16-power-digit-sum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-16-power-digit-sum.english.md index 431d1ab36e..9070e79235 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-16-power-digit-sum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-16-power-digit-sum.english.md @@ -7,8 +7,11 @@ forumTopicId: 301791 ## Description
+ 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. -What is the sum of the digits of the number 2exponent? + +What is the sum of the digits of the number 2`exponent`? +
## Instructions @@ -21,6 +24,8 @@ What is the sum of the digits of the number 2exponent? ```yml tests: + - text: powerDigitSum(15) should return a number. + testString: assert(typeof powerDigitSum(15) === 'number'); - text: powerDigitSum(15) should return 26. testString: assert.strictEqual(powerDigitSum(15), 26); - text: powerDigitSum(128) should return 166. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-17-number-letter-counts.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-17-number-letter-counts.english.md index eeb7488b29..4ee073689e 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-17-number-letter-counts.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-17-number-letter-counts.english.md @@ -7,9 +7,13 @@ forumTopicId: 301804 ## 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 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. + +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. +
## Instructions @@ -22,6 +26,8 @@ If all the numbers from 1 to given limit inclusive were written out ```yml tests: + - text: numberLetterCounts(5) should return a number. + testString: assert(typeof numberLetterCounts(5) === 'number'); - text: numberLetterCounts(5) should return 19. testString: assert.strictEqual(numberLetterCounts(5), 19); - text: numberLetterCounts(150) should return 1903. @@ -120,7 +126,6 @@ function numberLetterCounts(limit) { tempStr += dictionary[tens] + dictionary[remainder]; } } - // console.log(num, hundreds, tens, remainder); return tempStr; } } diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-18-maximum-path-sum-i.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-18-maximum-path-sum-i.english.md index 7811b6c42b..f0d57c511c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-18-maximum-path-sum-i.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-18-maximum-path-sum-i.english.md @@ -7,12 +7,24 @@ forumTopicId: 301815 ## 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. -3
7 4
2 4 6
8 5 9 3
+ + + 3
+ 7 4
+ 2 4 6
+ 8 5 9 3 +
+ That is, 3 + 7 + 4 + 9 = 23. + Find the maximum total from top to bottom of the triangle below: + 75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
-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) + +**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) +
## Instructions @@ -25,6 +37,8 @@ Find the maximum total from top to bottom of the triangle below: ```yml tests: + - text: maximumPathSumI(testTriangle) should return a number. + testString: assert(typeof maximumPathSumI(testTriangle) === 'number'); - text: maximumPathSumI(testTriangle) should return 23. testString: assert.strictEqual(maximumPathSumI(testTriangle), 23); - text: maximumPathSumI(numTriangle) should return 1074. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-19-counting-sundays.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-19-counting-sundays.english.md index 7c77e01dea..8fa027b27b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-19-counting-sundays.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-19-counting-sundays.english.md @@ -7,9 +7,17 @@ forumTopicId: 301827 ## Description
+ You are given the following information, but you may prefer to do some research for yourself. -
## Instructions @@ -22,6 +30,8 @@ How many Sundays fell on the first of the month during the twentieth century (1 ```yml tests: + - text: countingSundays(1943, 1946) should return a number. + testString: assert(typeof countingSundays(1943, 1946) === 'number'); - text: countingSundays(1943, 1946) should return 6. testString: assert.strictEqual(countingSundays(1943, 1946), 6); - text: countingSundays(1995, 2000) should return 10. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers.english.md index 842f47e177..7436258864 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-2-even-fibonacci-numbers.english.md @@ -7,8 +7,11 @@ forumTopicId: 301838 ## 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: +
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
+ By considering the terms in the Fibonacci sequence whose values do not exceed n, find the sum of the even-valued terms.
@@ -22,6 +25,8 @@ By considering the terms in the Fibonacci sequence whose values do not exceed fiboEvenSum(10) should return a number. + testString: assert(typeof fiboEvenSum(10) === 'number'); - text: fiboEvenSum(10) should return 10. testString: assert.strictEqual(fiboEvenSum(10), 10); - text: fiboEvenSum(60) should return 44. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-20-factorial-digit-sum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-20-factorial-digit-sum.english.md index 8f650ecc4e..8b0814905a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-20-factorial-digit-sum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-20-factorial-digit-sum.english.md @@ -7,9 +7,13 @@ forumTopicId: 301839 ## Description
+ n! means n × (n − 1) × ... × 3 × 2 × 1 + For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
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 n! + +Find the sum of the digits `n`! +
## Instructions @@ -22,6 +26,8 @@ Find the sum of the digits n! ```yml tests: + - text: sumFactorialDigits(10) should return a number. + testString: assert(typeof sumFactorialDigits(10) === 'number'); - text: sumFactorialDigits(10) should return 27. testString: assert.strictEqual(sumFactorialDigits(10), 27); - text: sumFactorialDigits(25) should return 72. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-21-amicable-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-21-amicable-numbers.english.md index a042531602..bec9504ffa 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-21-amicable-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-21-amicable-numbers.english.md @@ -7,10 +7,15 @@ forumTopicId: 301851 ## Description
+ Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). + If d(a) = b and d(b) = a, where ab, then a and b are an amicable pair and each of a and b 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 n. + +Evaluate the sum of all the amicable numbers under `n`. +
## Instructions @@ -23,6 +28,8 @@ Evaluate the sum of all the amicable numbers under n. ```yml tests: + - text: sumAmicableNum(1000) should return a number. + testString: assert(typeof sumAmicableNum(1000) === 'number'); - text: sumAmicableNum(1000) should return 504. testString: assert.strictEqual(sumAmicableNum(1000), 504); - text: sumAmicableNum(2000) should return 2898. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-22-names-scores.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-22-names-scores.english.md index d70b5641f0..5bf87903e0 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-22-names-scores.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-22-names-scores.english.md @@ -7,9 +7,13 @@ forumTopicId: 301862 ## Description
-Using names, 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? +
## Instructions @@ -22,6 +26,8 @@ What is the total of all the name scores in the file? ```yml tests: + - text: namesScores(test1) should return a number. + testString: assert(typeof namesScores(test1) === 'number'); - text: namesScores(test1) should return 791. testString: assert.strictEqual(namesScores(test1), 791); - text: namesScores(test2) should return 1468. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-23-non-abundant-sums.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-23-non-abundant-sums.english.md index b3e378405f..a243b9e086 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-23-non-abundant-sums.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-23-non-abundant-sums.english.md @@ -7,10 +7,15 @@ forumTopicId: 301873 ## 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 n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n. + 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 <= n 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. +
## Instructions @@ -23,6 +28,8 @@ Find the sum of all positive integers <= n which cannot be written as ```yml tests: + - text: sumOfNonAbundantNumbers(10000) should return a number. + testString: assert(typeof sumOfNonAbundantNumbers(10000) === 'number'); - text: sumOfNonAbundantNumbers(10000) should return 3731004. testString: assert(sumOfNonAbundantNumbers(10000) === 3731004); - text: sumOfNonAbundantNumbers(15000) should return 4039939. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-24-lexicographic-permutations.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-24-lexicographic-permutations.english.md index bdf4f3a18c..fd640b3b61 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-24-lexicographic-permutations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-24-lexicographic-permutations.english.md @@ -7,9 +7,13 @@ forumTopicId: 301885 ## 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: +
012   021   102   120   201   210
-What is the nth 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? +
## Instructions @@ -22,6 +26,8 @@ What is the nth lexicographic permutation of the digits 0, 1, 2, 3, 4 ```yml tests: + - text: lexicographicPermutations(699999) should return a number. + testString: assert(typeof lexicographicPermutations(699999) === 'number'); - text: lexicographicPermutations(699999) should return 1938246570. testString: assert(lexicographicPermutations(699999) == 1938246570); - text: lexicographicPermutations(899999) should return 2536987410. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-25-1000-digit-fibonacci-number.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-25-1000-digit-fibonacci-number.english.md index 3f1be48afd..3c0fa273f1 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-25-1000-digit-fibonacci-number.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-25-1000-digit-fibonacci-number.english.md @@ -7,12 +7,19 @@ forumTopicId: 301897 ## Description
+ The Fibonacci sequence is defined by the recurrence relation: +
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
+ Hence the first 12 terms will be: +
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
+ The 12th term, F12, is the first term to contain three digits. -What is the index of the first term in the Fibonacci sequence to contain n digits? + +What is the index of the first term in the Fibonacci sequence to contain `n` digits? +
## Instructions @@ -25,6 +32,8 @@ What is the index of the first term in the Fibonacci sequence to contain n< ```yml tests: + - text: digitFibonacci(5) should return a number. + testString: assert(typeof digitFibonacci(5) === 'number'); - text: digitFibonacci(5) should return 21. testString: assert.strictEqual(digitFibonacci(5), 21); - text: digitFibonacci(10) should return 45. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-26-reciprocal-cycles.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-26-reciprocal-cycles.english.md index 271cd34553..d370f1fe36 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-26-reciprocal-cycles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-26-reciprocal-cycles.english.md @@ -7,10 +7,15 @@ forumTopicId: 301908 ## Description
+ A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: +
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
+ Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle. -Find the value of d < n for which 1/d contains the longest recurring cycle in its decimal fraction part. + +Find the value of d < `n` for which 1/d contains the longest recurring cycle in its decimal fraction part. +
## Instructions @@ -23,6 +28,8 @@ Find the value of d < n for which 1/dreciprocalCycles(700) should return a number. + testString: assert(typeof reciprocalCycles(700) === 'number'); - text: reciprocalCycles(700) should return 659. testString: assert(reciprocalCycles(700) == 659); - text: reciprocalCycles(800) should return 743. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-27-quadratic-primes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-27-quadratic-primes.english.md index 52222a67dd..d038a859c6 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-27-quadratic-primes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-27-quadratic-primes.english.md @@ -7,15 +7,25 @@ forumTopicId: 301919 ## Description
+ Euler discovered the remarkable quadratic formula: -$n^2 + n + 41$ + +
$n^2 + n + 41$
+ 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$ +
+ $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$
+
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$. +
## Instructions @@ -28,6 +38,8 @@ Find the product of the coefficients, $a$ and $b$, for the quadratic expression ```yml tests: + - text: quadraticPrimes(200) should return a number. + testString: assert(typeof quadraticPrimes(200) === 'number'); - text: quadraticPrimes(200) should return -4925. testString: assert(quadraticPrimes(200) == -4925); - text: quadraticPrimes(500) should return -18901. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-28-number-spiral-diagonals.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-28-number-spiral-diagonals.english.md index 299420f242..ecc5fe1e67 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-28-number-spiral-diagonals.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-28-number-spiral-diagonals.english.md @@ -7,14 +7,21 @@ forumTopicId: 301930 ## 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 + +
+
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

+
+ 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? +
## 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: spiralDiagonals(101) should return a number. + testString: assert(typeof spiralDiagonals(101) === 'number'); - text: spiralDiagonals(101) should return 692101. testString: assert(spiralDiagonals(101) == 692101); - text: spiralDiagonals(303) should return 18591725. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-29-distinct-powers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-29-distinct-powers.english.md index 6928b8edba..faa653450e 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-29-distinct-powers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-29-distinct-powers.english.md @@ -7,14 +7,24 @@ forumTopicId: 301941 ## 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 + +
+ 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
+
+ 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? + +
+ 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`? +
## Instructions @@ -27,6 +37,8 @@ How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ n an ```yml tests: + - text: distinctPowers(15) should return a number. + testString: assert(typeof distinctPowers(15) === 'number'); - text: distinctPowers(15) should return 177. testString: assert.strictEqual(distinctPowers(15), 177); - text: distinctPowers(20) should return 324. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-3-largest-prime-factor.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-3-largest-prime-factor.english.md index b6e771d62f..61eb2e3a4a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-3-largest-prime-factor.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-3-largest-prime-factor.english.md @@ -7,8 +7,11 @@ forumTopicId: 301952 ## Description
+ The prime factors of 13195 are 5, 7, 13 and 29. -What is the largest prime factor of the given number? + +What is the largest prime factor of the given `number`? +
## Instructions @@ -21,6 +24,8 @@ What is the largest prime factor of the given number? ```yml tests: + - text: largestPrimeFactor(2) should return a number. + testString: assert(typeof largestPrimeFactor(2) === 'number'); - text: largestPrimeFactor(2) should return 2. testString: assert.strictEqual(largestPrimeFactor(2), 2); - text: largestPrimeFactor(3) should return 3. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-30-digit-n-powers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-30-digit-n-powers.english.md index b9112523fb..cfcdb839c1 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-30-digit-n-powers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-30-digit-n-powers.english.md @@ -7,13 +7,21 @@ forumTopicId: 301953 ## Description
+ Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: -1634 = 14 + 64 + 34 + 44 -8208 = 84 + 24 + 04 + 84 -9474 = 94 + 44 + 74 + 44 + +
+ 1634 = 14 + 64 + 34 + 44
+ 8208 = 84 + 24 + 04 + 84
+ 9474 = 94 + 44 + 74 + 44
+
+ As 1 = 14 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. +
## 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: digitnPowers(2) should return a number. + testString: assert(typeof digitnPowers(2) === 'number'); - text: digitnPowers(2) should return 0. testString: assert(digitnPowers(2) == 0); - text: digitnPowers(3) should return 1301. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-31-coin-sums.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-31-coin-sums.english.md index 2ea37bec2e..7055b66351 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-31-coin-sums.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-31-coin-sums.english.md @@ -7,11 +7,17 @@ forumTopicId: 301965 ## 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). + +
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
+ 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? + +
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? +
## Instructions @@ -24,6 +30,8 @@ How many different ways can n pence be made using any number of coins? ```yml tests: + - text: coinSums(50) should return a number. + testString: assert(typeof coinSums(50) === 'number'); - text: coinSums(50) should return 451. testString: assert(coinSums(50) == 451); - text: coinSums(100) should return 4563. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-32-pandigital-products.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-32-pandigital-products.english.md index c2c7452d9d..d747538f19 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-32-pandigital-products.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-32-pandigital-products.english.md @@ -7,13 +7,15 @@ forumTopicId: 301976 ## 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 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. 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. +
## 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: pandigitalProducts() should be a function. - testString: assert(typeof pandigitalProducts === 'function'); + - text: pandigitalProducts() should return a number. + testString: assert(typeof pandigitalProducts() === 'number'); - text: pandigitalProducts() should return 45228. testString: assert.strictEqual(pandigitalProducts(), 45228); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-33-digit-cancelling-fractions.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-33-digit-cancelling-fractions.english.md index e02d158f07..60bf9b22da 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-33-digit-cancelling-fractions.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-33-digit-cancelling-fractions.english.md @@ -7,10 +7,15 @@ forumTopicId: 301987 ## Description
+ The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. + We shall consider fractions like, 30/50 = 3/5, 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. +
## Instructions @@ -23,6 +28,8 @@ If the product of these four fractions is given in its lowest common terms, find ```yml tests: + - text: digitCancellingFractions() should return a number. + testString: assert(typeof digitCancellingFractions() === 'number'); - text: digitCancellingFractions() should return 100. testString: assert.strictEqual(digitCancellingFractions(), 100); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-34-digit-factorials.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-34-digit-factorials.english.md index a33c67bd77..188def2771 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-34-digit-factorials.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-34-digit-factorials.english.md @@ -7,9 +7,13 @@ forumTopicId: 301998 ## 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. +
## Instructions @@ -22,8 +26,12 @@ Note: as 1! = 1 and 2! = 2 are not sums they are not included. ```yml tests: - - text: 'digitFactorial() should return { sum: 40730, numbers: [145, 40585] }.' - testString: "assert.deepEqual(digitFactorial(), { sum: 40730, numbers: [145, 40585] });" + - text: digitFactorial() should return an object. + testString: assert.typeOf(digitFactorial(), 'object'); + - text: | + digitFactorial() should return { sum: 40730, numbers: [145, 40585] }. + testString: | + assert.deepEqual(digitFactorial(), { sum: 40730, numbers: [145, 40585] }); ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-35-circular-primes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-35-circular-primes.english.md index 8d4065026d..f9e154ac9a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-35-circular-primes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-35-circular-primes.english.md @@ -7,12 +7,17 @@ forumTopicId: 302009 ## 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?
Note:
+ Circular primes individual rotation can exceed `n`. +
## Instructions @@ -25,6 +30,8 @@ Circular primes individual rotation can exceed `n`. ```yml tests: + - text: circularPrimes(100) should return a number. + testString: assert(typeof circularPrimes(100) === 'number'); - text: circularPrimes(100) should return 13. testString: assert(circularPrimes(100) == 13); - text: circularPrimes(100000) should return 43. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-36-double-base-palindromes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-36-double-base-palindromes.english.md index ca272f86e3..f792feff58 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-36-double-base-palindromes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-36-double-base-palindromes.english.md @@ -7,9 +7,13 @@ forumTopicId: 302020 ## 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 = 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. + (Please note that the palindromic number, in either base, may not include leading zeros.) +
## Instructions @@ -22,6 +26,8 @@ Find the sum of all numbers, less than n, whereas 1000 <= n <= 1000000, which ar ```yml tests: + - text: doubleBasePalindromes(1000) should return a number. + testString: assert(typeof doubleBasePalindromes(1000) === 'number'); - text: doubleBasePalindromes(1000) should return 1772. testString: assert(doubleBasePalindromes(1000) == 1772); - text: doubleBasePalindromes(50000) should return 105795. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-37-truncatable-primes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-37-truncatable-primes.english.md index 062e11c510..17496eee98 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-37-truncatable-primes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-37-truncatable-primes.english.md @@ -7,9 +7,13 @@ forumTopicId: 302031 ## 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. +
## Instructions @@ -22,6 +26,8 @@ NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes. ```yml tests: + - text: truncatablePrimes(8) should return a number. + testString: assert(typeof truncatablePrimes(8) === 'number'); - text: truncatablePrimes(8) should return 1986. testString: assert(truncatablePrimes(8) == 1986); - text: truncatablePrimes(9) should return 5123. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-38-pandigital-multiples.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-38-pandigital-multiples.english.md index 1fcd08a93e..42d0b9678a 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-38-pandigital-multiples.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-38-pandigital-multiples.english.md @@ -7,13 +7,21 @@ forumTopicId: 302042 ## Description
+ Take the number 192 and multiply it by each of 1, 2, and 3: -192 × 1 = 192 -192 × 2 = 384 -192 × 3 = 576 + +
+ 192 × 1 = 192
+ 192 × 2 = 384
+ 192 × 3 = 576
+
+ 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, ... , n) where n > 1? +
## 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: pandigitalMultiples() should return a number. + testString: assert(typeof pandigitalMultiples() === 'number'); - text: pandigitalMultiples() should return 932718654. testString: assert.strictEqual(pandigitalMultiples(), 932718654); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-39-integer-right-triangles.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-39-integer-right-triangles.english.md index 8e7711d938..50cc8e9928 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-39-integer-right-triangles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-39-integer-right-triangles.english.md @@ -7,9 +7,13 @@ forumTopicId: 302054 ## 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 p 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 p ≤ `n`, is the number of solutions maximized? +
## Instructions @@ -22,6 +26,8 @@ For which value of p ≤ n, is the number of solutions maximised? ```yml tests: + - text: intRightTriangles(500) should return a number. + testString: assert(typeof intRightTriangles(500) === 'number'); - text: intRightTriangles(500) should return 420. testString: assert(intRightTriangles(500) == 420); - text: intRightTriangles(800) should return 720. @@ -46,7 +52,7 @@ function intRightTriangles(n) { return n; } -console.log(intRightTriangles(500)); // 420 +intRightTriangles(500); ``` @@ -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; diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-4-largest-palindrome-product.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-4-largest-palindrome-product.english.md index b7eb688ddc..6b5925bc43 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-4-largest-palindrome-product.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-4-largest-palindrome-product.english.md @@ -7,8 +7,11 @@ forumTopicId: 302065 ## 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 n-digit numbers. + +Find the largest palindrome made from the product of two `n`-digit numbers. +
## Instructions @@ -21,6 +24,8 @@ Find the largest palindrome made from the product of two n-digit nu ```yml tests: + - text: largestPalindromeProduct(2) should return a number. + testString: assert(typeof largestPalindromeProduct(2) === 'number'); - text: largestPalindromeProduct(2) should return 9009. testString: assert.strictEqual(largestPalindromeProduct(2), 9009); - text: largestPalindromeProduct(3) should return 906609. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-40-champernownes-constant.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-40-champernownes-constant.english.md index 40fc461504..6867361144 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-40-champernownes-constant.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-40-champernownes-constant.english.md @@ -7,11 +7,17 @@ forumTopicId: 302066 ## Description
+ An irrational decimal fraction is created by concatenating the positive integers: + 0.123456789101112131415161718192021... + It can be seen that the 12th digit of the fractional part is 1. + If dn represents the nth digit of the fractional part, find the value of the following expression. + d1 × d10 × d100 × d1000 × d10000 × d100000 × d1000000 +
## Instructions @@ -24,6 +30,8 @@ If dn represents the nth digit of the fracti ```yml tests: + - text: champernownesConstant(100) should return a number. + testString: assert(typeof champernownesConstant(100) === 'number'); - text: champernownesConstant(100) should return 5. testString: assert.strictEqual(champernownesConstant(100), 5); - text: champernownesConstant(1000) should return 15. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-41-pandigital-prime.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-41-pandigital-prime.english.md index 20cfaab594..dc0172e0ff 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-41-pandigital-prime.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-41-pandigital-prime.english.md @@ -7,8 +7,11 @@ forumTopicId: 302078 ## 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, 2143 is a 4-digit pandigital and is also prime. -What is the largest n-length digit pandigital prime that exists? + +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, 2143 is a 4-digit pandigital and is also prime. + +What is the largest `n`-length digit pandigital prime that exists? +
## Instructions @@ -21,6 +24,8 @@ What is the largest n-length digit pandigital prime that exists? ```yml tests: + - text: pandigitalPrime(4) should return a number. + testString: assert(typeof pandigitalPrime(4) === 'number'); - text: pandigitalPrime(4) should return 4231. testString: assert(pandigitalPrime(4) == 4231); - text: pandigitalPrime(7) should return 7652413. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-42-coded-triangle-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-42-coded-triangle-numbers.english.md index d8ddeccfc0..09ae70cce1 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-42-coded-triangle-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-42-coded-triangle-numbers.english.md @@ -7,10 +7,15 @@ forumTopicId: 302089 ## 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 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? +
## Instructions @@ -23,6 +28,8 @@ Using words array of n-length, how many are triangle words? ```yml tests: + - text: codedTriangleNumbers(1400) should return a number. + testString: assert(typeof codedTriangleNumbers(1400) === 'number'); - text: codedTriangleNumbers(1400) should return 129. testString: assert(codedTriangleNumbers(1400) == 129); - text: codedTriangleNumbers(1500) should return 137. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.english.md index 0e3acd42ff..78cc22631f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-43-sub-string-divisibility.english.md @@ -7,16 +7,23 @@ forumTopicId: 302100 ## 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 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
  • +
+ Find the numbers of all 0 to 9 pandigital numbers with this property. +
## Instructions @@ -29,6 +36,8 @@ Find the numbers of all 0 to 9 pandigital numbers with this property. ```yml tests: + - text: substringDivisibility() should return an array. + testString: assert(Array.isArray(substringDivisibility())); - text: substringDivisibility() should return [ 1430952867, 1460357289, 1406357289, 4130952867, 4160357289, 4106357289 ]. testString: assert.deepEqual(substringDivisibility(), [ 1430952867, 1460357289, 1406357289, 4130952867, 4160357289, 4106357289 ]); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-44-pentagon-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-44-pentagon-numbers.english.md index 979264d751..b9b5d9ce3c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-44-pentagon-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-44-pentagon-numbers.english.md @@ -7,10 +7,15 @@ forumTopicId: 302111 ## Description
+ Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are: + 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ... + It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal. -Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimised; what is the value of D? + +Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimized; what is the value of D? +
## Instructions @@ -23,6 +28,8 @@ Find the pair of pentagonal numbers, Pj and Pk, for which ```yml tests: + - text: pentagonNumbers() should return a number. + testString: assert(typeof pentagonNumbers() === 'number'); - text: pentagonNumbers() should return 5482660. testString: assert.strictEqual(pentagonNumbers(), 5482660); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-45-triangular-pentagonal-and-hexagonal.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-45-triangular-pentagonal-and-hexagonal.english.md index 4e07803699..9ef0e67cc1 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-45-triangular-pentagonal-and-hexagonal.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-45-triangular-pentagonal-and-hexagonal.english.md @@ -7,12 +7,17 @@ forumTopicId: 302122 ## Description
+ Triangle, pentagonal, and hexagonal numbers are generated by the following formulae: -
Triangle
Tn=n(n+1)/2
1, 3, 6, 10, 15, ...
-
Pentagonal
Pn=n(3n−1)/2
1, 5, 12, 22, 35, ...
-
Hexagonal
Hn=n(2n−1)
1, 6, 15, 28, 45, ...
+ +
Triangle
Tn=n(n+1)/2
1, 3, 6, 10, 15, ...
+
Pentagonal
Pn=n(3n−1)/2
1, 5, 12, 22, 35, ...
+
Hexagonal
Hn=n(2n−1)
1, 6, 15, 28, 45, ...
+ It can be verified that T285 = P165 = H143 = 40755. + Find the next triangle number that is also pentagonal and hexagonal. +
## Instructions @@ -25,6 +30,8 @@ Find the next triangle number that is also pentagonal and hexagonal. ```yml tests: + - text: triPentaHexa(40756) should return a number. + testString: assert(typeof triPentaHexa(40756) === 'number'); - text: triPentaHexa(40756) should return 1533776805. testString: assert.strictEqual(triPentaHexa(40756), 1533776805); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-46-goldbachs-other-conjecture.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-46-goldbachs-other-conjecture.english.md index d02498d2ce..f71eb8325f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-46-goldbachs-other-conjecture.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-46-goldbachs-other-conjecture.english.md @@ -7,15 +7,22 @@ forumTopicId: 302134 ## 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×12 -15 = 7 + 2×22 -21 = 3 + 2×32 -25 = 7 + 2×32 -27 = 19 + 2×22 -33 = 31 + 2×12 + +
+ 9 = 7 + 2×12
+ 15 = 7 + 2×22
+ 21 = 3 + 2×32
+ 25 = 7 + 2×32
+ 27 = 19 + 2×22
+ 33 = 31 + 2×12 +
+ 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? +
## Instructions @@ -28,6 +35,8 @@ What is the smallest odd composite that cannot be written as the sum of a prime ```yml tests: + - text: goldbachsOtherConjecture() should return a number. + testString: assert(typeof goldbachsOtherConjecture() === 'number'); - text: goldbachsOtherConjecture() should return 5777. testString: assert.strictEqual(goldbachsOtherConjecture(), 5777); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-47-distinct-primes-factors.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-47-distinct-primes-factors.english.md index 84d3ce3961..0aef92617f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-47-distinct-primes-factors.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-47-distinct-primes-factors.english.md @@ -7,14 +7,24 @@ forumTopicId: 302145 ## Description
+ The first two consecutive numbers to have two distinct prime factors are: -
14 = 2 × 7
-
15 = 3 × 5
+ +
+ 14 = 2 × 7
+ 15 = 3 × 5 +
+ The first three consecutive numbers to have three distinct prime factors are: -
644 = 2² × 7 × 23
-
645 = 3 × 5 × 43
-
646 = 2 × 17 × 19
+ +
+ 644 = 22 × 7 × 23
+ 645 = 3 × 5 × 43
+ 646 = 2 × 17 × 19 +
+ Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? +
## Instructions @@ -27,6 +37,8 @@ Find the first four consecutive integers to have four distinct prime factors eac ```yml tests: + - text: distinctPrimeFactors(2, 2) should return a number. + testString: assert(typeof distinctPrimeFactors(2, 2) === 'number'); - text: distinctPrimeFactors(2, 2) should return 14. testString: assert.strictEqual(distinctPrimeFactors(2, 2), 14); - text: distinctPrimeFactors(3, 3) should return 644. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-48-self-powers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-48-self-powers.english.md index 8a7765d609..e05824bdbf 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-48-self-powers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-48-self-powers.english.md @@ -7,8 +7,11 @@ forumTopicId: 302157 ## Description
+ The series, 11 + 22 + 33 + ... + 1010 = 10405071317. + Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000. +
## Instructions @@ -21,6 +24,8 @@ Find the last ten digits of the series, 11 + 22 + 33< ```yml tests: + - text: selfPowers(10, 3) should return a number. + testString: assert(typeof selfPowers(10, 3) === 'number'); - text: selfPowers(10, 3) should return 317. testString: assert.strictEqual(selfPowers(10, 3), 317); - text: selfPowers(150, 6) should return 29045. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-49-prime-permutations.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-49-prime-permutations.english.md index 4f85dc275e..f881572e69 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-49-prime-permutations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-49-prime-permutations.english.md @@ -7,9 +7,13 @@ forumTopicId: 302159 ## 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? +
## Instructions @@ -22,6 +26,8 @@ What 12-digit number do you form by concatenating the three terms in this sequen ```yml tests: + - text: primePermutations() should return a number. + testString: assert(typeof primePermutations() === 'number'); - text: primePermutations() should return 296962999629. testString: assert.strictEqual(primePermutations(), 296962999629); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-5-smallest-multiple.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-5-smallest-multiple.english.md index ffe461fc33..08312be1a5 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-5-smallest-multiple.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-5-smallest-multiple.english.md @@ -7,8 +7,11 @@ forumTopicId: 302160 ## 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 n? + +What is the smallest positive number that is evenly divisible by all of the numbers from 1 to `n`? +
## Instructions @@ -21,6 +24,8 @@ What is the smallest positive number that is evenly divisible by all of the numb ```yml tests: + - text: smallestMult(5) should return a number. + testString: assert(typeof smallestMult(5) === 'number'); - text: smallestMult(5) should return 60. testString: assert.strictEqual(smallestMult(5), 60); - text: smallestMult(7) should return 420. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-50-consecutive-prime-sum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-50-consecutive-prime-sum.english.md index ee7d9c47fd..0cc8abb627 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-50-consecutive-prime-sum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-50-consecutive-prime-sum.english.md @@ -7,11 +7,17 @@ forumTopicId: 302161 ## Description
+ The prime 41, can be written as the sum of six consecutive primes: -41 = 2 + 3 + 5 + 7 + 11 + 13 + +
41 = 2 + 3 + 5 + 7 + 11 + 13
+ 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? +
## Instructions @@ -24,6 +30,8 @@ Which prime, below one-million, can be written as the sum of the most consecutiv ```yml tests: + - text: consecutivePrimeSum(1000) should return a number. + testString: assert(typeof consecutivePrimeSum(1000) === 'number'); - text: consecutivePrimeSum(1000) should return 953. testString: assert.strictEqual(consecutivePrimeSum(1000), 953); - text: consecutivePrimeSum(1000000) should return 997651. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.english.md index b4aa1c8753..506b6cc667 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-51-prime-digit-replacements.english.md @@ -7,9 +7,13 @@ forumTopicId: 302162 ## 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. +
## Instructions @@ -22,8 +26,10 @@ Find the smallest prime which, by replacing part of the number (not necessarily ```yml tests: - - text: euler51() should return 121313. - testString: assert.strictEqual(euler51(), 121313); + - text: primeDigitReplacements() should return a number. + testString: assert(typeof primeDigitReplacements() === 'number'); + - text: primeDigitReplacements() should return 121313. + testString: assert.strictEqual(primeDigitReplacements(), 121313); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler51() { +function primeDigitReplacements() { // Good luck! return true; } -euler51(); +primeDigitReplacements(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-52-permuted-multiples.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-52-permuted-multiples.english.md index 57a0a1b87a..ef6b8cf05b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-52-permuted-multiples.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-52-permuted-multiples.english.md @@ -7,8 +7,11 @@ forumTopicId: 302163 ## 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, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits. +
## Instructions @@ -21,6 +24,8 @@ Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain ```yml tests: + - text: permutedMultiples() should return a number. + testString: assert(typeof permutedMultiples() === 'number'); - text: permutedMultiples() should return 142857. testString: assert.strictEqual(permutedMultiples(), 142857); diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-53-combinatoric-selections.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-53-combinatoric-selections.english.md index 99530bd59f..9d9419f697 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-53-combinatoric-selections.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-53-combinatoric-selections.english.md @@ -7,17 +7,19 @@ forumTopicId: 302164 ## 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. +
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
+ +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?
## Instructions @@ -30,6 +32,8 @@ How many, not necessarily distinct, values of  nCr, for 1 ≤ n ≤ 100, are gr ```yml tests: + - text: combinatoricSelections(1000) should return a number. + testString: assert(typeof combinatoricSelections(1000) === 'number'); - text: combinatoricSelections(1000) should return 4626. testString: assert.strictEqual(combinatoricSelections(1000), 4626); - text: combinatoricSelections(10000) should return 4431. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-54-poker-hands.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-54-poker-hands.english.md index 2f47350bf7..dc5723d607 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-54-poker-hands.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-54-poker-hands.english.md @@ -7,19 +7,27 @@ forumTopicId: 302165 ## Description
+ In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way: -High Card: Highest value card. -One Pair: Two cards of the same value. -Two Pairs: Two different pairs. -Three of a Kind: Three cards of the same value. -Straight: All cards are consecutive values. -Flush: All cards of the same suit. -Full House: Three of a kind and a pair. -Four of a Kind: Four cards of the same value. -Straight Flush: All cards are consecutive values of same suit. -Royal Flush: Ten, Jack, Queen, King, Ace, in same suit. -The cards are valued in the order:2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace. + +
    +
  • High Card: Highest value card.
  • +
  • One Pair: Two cards of the same value.
  • +
  • Two Pairs: Two different pairs.
  • +
  • Three of a Kind: Three cards of the same value.
  • +
  • Straight: All cards are consecutive values.
  • +
  • Flush: All cards of the same suit.
  • +
  • Full House: Three of a kind and a pair.
  • +
  • Four of a Kind: Four cards of the same value.
  • +
  • Straight Flush: All cards are consecutive values of same suit.
  • +
  • Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.
  • +
+ +The cards are valued in the order: +2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace. + If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on. + Consider the following five hands dealt to two players: |Hand|Player 1|Player 2|Winner| @@ -30,8 +38,8 @@ Consider the following five hands dealt to two players: |4|4D 6S 9H QH QC
Pair of Queens
Highest card Nine|3D 6D 7H QD QS
Pair of Queens
Highest card Seven|Player 1| |5|2H 2D 4C 4D 4S
Full House
with Three Fours|3C 3D 3S 9S 9D
Full House
with Three Threes|Player 1| -The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner. How many hands does Player 1 win? +
## Instructions @@ -44,8 +52,12 @@ How many hands does Player 1 win? ```yml tests: - - text: euler54() should return 376. - testString: assert.strictEqual(euler54(), 376); + - text: pokerHands(testArr) should return a number. + testString: assert(typeof pokerHands(testArr) === 'number'); + - text: pokerHands(testArr) should return 2. + testString: assert.strictEqual(pokerHands(testArr), 2); + - text: pokerHands(handsArr) should return 376. + testString: assert.strictEqual(pokerHands(handsArr), 376); ``` @@ -57,20 +69,1041 @@ tests:
```js -function euler54() { +function pokerHands(arr) { // Good luck! return true; } -euler54(); +const testArr = [ + '8C TS KC 9H 4S 7D 2S 5D 3S AC', + '5C AD 5D AC 9C 7C 5H 8D TD KS', + '3H 7H 6S KC JS QH TD JC 2D 8S', + 'TH 8H 5C QS TC 9H 4D JC KS JS', + '7C 5H KC QH JD AS KH 4C AD 4S' +]; + +pokerHands(testArr); ```
+### Before Test +
+ +```js +const handsArr = [ + '8C TS KC 9H 4S 7D 2S 5D 3S AC', + '5C AD 5D AC 9C 7C 5H 8D TD KS', + '3H 7H 6S KC JS QH TD JC 2D 8S', + 'TH 8H 5C QS TC 9H 4D JC KS JS', + '7C 5H KC QH JD AS KH 4C AD 4S', + '5H KS 9C 7D 9H 8D 3S 5D 5C AH', + '6H 4H 5C 3H 2H 3S QH 5S 6S AS', + 'TD 8C 4H 7C TC KC 4C 3H 7S KS', + '7C 9C 6D KD 3H 4C QS QC AC KH', + 'JC 6S 5H 2H 2D KD 9D 7C AS JS', + 'AD QH TH 9D 8H TS 6D 3S AS AC', + '2H 4S 5C 5S TC KC JD 6C TS 3C', + 'QD AS 6H JS 2C 3D 9H KC 4H 8S', + 'KD 8S 9S 7C 2S 3S 6D 6S 4H KC', + '3C 8C 2D 7D 4D 9S 4S QH 4H JD', + '8C KC 7S TC 2D TS 8H QD AC 5C', + '3D KH QD 6C 6S AD AS 8H 2H QS', + '6S 8D 4C 8S 6C QH TC 6D 7D 9D', + '2S 8D 8C 4C TS 9S 9D 9C AC 3D', + '3C QS 2S 4H JH 3D 2D TD 8S 9H', + '5H QS 8S 6D 3C 8C JD AS 7H 7D', + '6H TD 9D AS JH 6C QC 9S KD JC', + 'AH 8S QS 4D TH AC TS 3C 3D 5C', + '5S 4D JS 3D 8H 6C TS 3S AD 8C', + '6D 7C 5D 5H 3S 5C JC 2H 5S 3D', + '5H 6H 2S KS 3D 5D JD 7H JS 8H', + 'KH 4H AS JS QS QC TC 6D 7C KS', + '3D QS TS 2H JS 4D AS 9S JC KD', + 'QD 5H 4D 5D KH 7H 3D JS KD 4H', + '2C 9H 6H 5C 9D 6C JC 2D TH 9S', + '7D 6D AS QD JH 4D JS 7C QS 5C', + '3H KH QD AD 8C 8H 3S TH 9D 5S', + 'AH 9S 4D 9D 8S 4H JS 3C TC 8D', + '2C KS 5H QD 3S TS 9H AH AD 8S', + '5C 7H 5D KD 9H 4D 3D 2D KS AD', + 'KS KC 9S 6D 2C QH 9D 9H TS TC', + '9C 6H 5D QH 4D AD 6D QC JS KH', + '9S 3H 9D JD 5C 4D 9H AS TC QH', + '2C 6D JC 9C 3C AD 9S KH 9D 7D', + 'KC 9C 7C JC JS KD 3H AS 3C 7D', + 'QD KH QS 2C 3S 8S 8H 9H 9C JC', + 'QH 8D 3C KC 4C 4H 6D AD 9H 9D', + '3S KS QS 7H KH 7D 5H 5D JD AD', + '2H 2C 6H TH TC 7D 8D 4H 8C AS', + '4S 2H AC QC 3S 6D TH 4D 4C KH', + '4D TC KS AS 7C 3C 6D 2D 9H 6C', + '8C TD 5D QS 2C 7H 4C 9C 3H 9H', + '5H JH TS 7S TD 6H AD QD 8H 8S', + '5S AD 9C 8C 7C 8D 5H 9D 8S 2S', + '4H KH KS 9S 2S KC 5S AD 4S 7D', + 'QS 9C QD 6H JS 5D AC 8D 2S AS', + 'KH AC JC 3S 9D 9S 3C 9C 5S JS', + 'AD 3C 3D KS 3S 5C 9C 8C TS 4S', + 'JH 8D 5D 6H KD QS QD 3D 6C KC', + '8S JD 6C 3S 8C TC QC 3C QH JS', + 'KC JC 8H 2S 9H 9C JH 8S 8C 9S', + '8S 2H QH 4D QC 9D KC AS TH 3C', + '8S 6H TH 7C 2H 6S 3C 3H AS 7S', + 'QH 5S JS 4H 5H TS 8H AH AC JC', + '9D 8H 2S 4S TC JC 3C 7H 3H 5C', + '3D AD 3C 3S 4C QC AS 5D TH 8C', + '6S 9D 4C JS KH AH TS JD 8H AD', + '4C 6S 9D 7S AC 4D 3D 3S TC JD', + 'AD 7H 6H 4H JH KC TD TS 7D 6S', + '8H JH TC 3S 8D 8C 9S 2C 5C 4D', + '2C 9D KC QH TH QS JC 9C 4H TS', + 'QS 3C QD 8H KH 4H 8D TD 8S AC', + '7C 3C TH 5S 8H 8C 9C JD TC KD', + 'QC TC JD TS 8C 3H 6H KD 7C TD', + 'JH QS KS 9C 6D 6S AS 9H KH 6H', + '2H 4D AH 2D JH 6H TD 5D 4H JD', + 'KD 8C 9S JH QD JS 2C QS 5C 7C', + '4S TC 7H 8D 2S 6H 7S 9C 7C KC', + '8C 5D 7H 4S TD QC 8S JS 4H KS', + 'AD 8S JH 6D TD KD 7C 6C 2D 7D', + 'JC 6H 6S JS 4H QH 9H AH 4C 3C', + '6H 5H AS 7C 7S 3D KH KC 5D 5C', + 'JC 3D TD AS 4D 6D 6S QH JD KS', + '8C 7S 8S QH 2S JD 5C 7H AH QD', + '8S 3C 6H 6C 2C 8D TD 7D 4C 4D', + '5D QH KH 7C 2S 7H JS 6D QC QD', + 'AD 6C 6S 7D TH 6H 2H 8H KH 4H', + 'KS JS KD 5D 2D KH 7D 9C 8C 3D', + '9C 6D QD 3C KS 3S 7S AH JD 2D', + 'AH QH AS JC 8S 8H 4C KC TH 7D', + 'JC 5H TD 7C 5D KD 4C AD 8H JS', + 'KC 2H AC AH 7D JH KH 5D 7S 6D', + '9S 5S 9C 6H 8S TD JD 9H 6C AC', + '7D 8S 6D TS KD 7H AC 5S 7C 5D', + 'AH QC JC 4C TC 8C 2H TS 2C 7D', + 'KD KC 6S 3D 7D 2S 8S 3H 5S 5C', + '8S 5D 8H 4C 6H KC 3H 7C 5S KD', + 'JH 8C 3D 3C 6C KC TD 7H 7C 4C', + 'JC KC 6H TS QS TD KS 8H 8C 9S', + '6C 5S 9C QH 7D AH KS KC 9S 2C', + '4D 4S 8H TD 9C 3S 7D 9D AS TH', + '6S 7D 3C 6H 5D KD 2C 5C 9D 9C', + '2H KC 3D AD 3H QD QS 8D JC 4S', + '8C 3H 9C 7C AD 5D JC 9D JS AS', + '5D 9H 5C 7H 6S 6C QC JC QD 9S', + 'JC QS JH 2C 6S 9C QC 3D 4S TC', + '4H 5S 8D 3D 4D 2S KC 2H JS 2C', + 'TD 3S TH KD 4D 7H JH JS KS AC', + '7S 8C 9S 2D 8S 7D 5C AD 9D AS', + '8C 7H 2S 6C TH 3H 4C 3S 8H AC', + 'KD 5H JC 8H JD 2D 4H TD JH 5C', + '3D AS QH KS 7H JD 8S 5S 6D 5H', + '9S 6S TC QS JC 5C 5D 9C TH 8C', + '5H 3S JH 9H 2S 2C 6S 7S AS KS', + '8C QD JC QS TC QC 4H AC KH 6C', + 'TC 5H 7D JH 4H 2H 8D JC KS 4D', + '5S 9C KH KD 9H 5C TS 3D 7D 2D', + '5H AS TC 4D 8C 2C TS 9D 3H 8D', + '6H 8D 2D 9H JD 6C 4S 5H 5S 6D', + 'AD 9C JC 7D 6H 9S 6D JS 9H 3C', + 'AD JH TC QS 4C 5D 9S 7C 9C AH', + 'KD 6H 2H TH 8S QD KS 9D 9H AS', + '4H 8H 8D 5H 6C AH 5S AS AD 8S', + 'QS 5D 4S 2H TD KS 5H AC 3H JC', + '9C 7D QD KD AC 6D 5H QH 6H 5S', + 'KC AH QH 2H 7D QS 3H KS 7S JD', + '6C 8S 3H 6D KS QD 5D 5C 8H TC', + '9H 4D 4S 6S 9D KH QC 4H 6C JD', + 'TD 2D QH 4S 6H JH KD 3C QD 8C', + '4S 6H 7C QD 9D AS AH 6S AD 3C', + '2C KC TH 6H 8D AH 5C 6D 8S 5D', + 'TD TS 7C AD JC QD 9H 3C KC 7H', + '5D 4D 5S 8H 4H 7D 3H JD KD 2D', + 'JH TD 6H QS 4S KD 5C 8S 7D 8H', + 'AC 3D AS 8C TD 7H KH 5D 6C JD', + '9D KS 7C 6D QH TC JD KD AS KC', + 'JH 8S 5S 7S 7D AS 2D 3D AD 2H', + '2H 5D AS 3C QD KC 6H 9H 9S 2C', + '9D 5D TH 4C JH 3H 8D TC 8H 9H', + '6H KD 2C TD 2H 6C 9D 2D JS 8C', + 'KD 7S 3C 7C AS QH TS AD 8C 2S', + 'QS 8H 6C JS 4C 9S QC AD TD TS', + '2H 7C TS TC 8C 3C 9H 2D 6D JC', + 'TC 2H 8D JH KS 6D 3H TD TH 8H', + '9D TD 9H QC 5D 6C 8H 8C KC TS', + '2H 8C 3D AH 4D TH TC 7D 8H KC', + 'TS 5C 2D 8C 6S KH AH 5H 6H KC', + '5S 5D AH TC 4C JD 8D 6H 8C 6C', + 'KC QD 3D 8H 2D JC 9H 4H AD 2S', + 'TD 6S 7D JS KD 4H QS 2S 3S 8C', + '4C 9H JH TS 3S 4H QC 5S 9S 9C', + '2C KD 9H JS 9S 3H JC TS 5D AC', + 'AS 2H 5D AD 5H JC 7S TD JS 4C', + '2D 4S 8H 3D 7D 2C AD KD 9C TS', + '7H QD JH 5H JS AC 3D TH 4C 8H', + '6D KH KC QD 5C AD 7C 2D 4H AC', + '3D 9D TC 8S QD 2C JC 4H JD AH', + '6C TD 5S TC 8S AH 2C 5D AS AC', + 'TH 7S 3D AS 6C 4C 7H 7D 4H AH', + '5C 2H KS 6H 7S 4H 5H 3D 3C 7H', + '3C 9S AC 7S QH 2H 3D 6S 3S 3H', + '2D 3H AS 2C 6H TC JS 6S 9C 6C', + 'QH KD QD 6D AC 6H KH 2C TS 8C', + '8H 7D 3S 9H 5D 3H 4S QC 9S 5H', + '2D 9D 7H 6H 3C 8S 5H 4D 3S 4S', + 'KD 9S 4S TC 7S QC 3S 8S 2H 7H', + 'TC 3D 8C 3H 6C 2H 6H KS KD 4D', + 'KC 3D 9S 3H JS 4S 8H 2D 6C 8S', + '6H QS 6C TC QD 9H 7D 7C 5H 4D', + 'TD 9D 8D 6S 6C TC 5D TS JS 8H', + '4H KC JD 9H TC 2C 6S 5H 8H AS', + 'JS 9C 5C 6S 9D JD 8H KC 4C 6D', + '4D 8D 8S 6C 7C 6H 7H 8H 5C KC', + 'TC 3D JC 6D KS 9S 6H 7S 9C 2C', + '6C 3S KD 5H TS 7D 9H 9S 6H KH', + '3D QD 4C 6H TS AC 3S 5C 2H KD', + '4C AS JS 9S 7C TS 7H 9H JC KS', + '4H 8C JD 3H 6H AD 9S 4S 5S KS', + '4C 2C 7D 3D AS 9C 2S QS KC 6C', + '8S 5H 3D 2S AC 9D 6S 3S 4D TD', + 'QD TH 7S TS 3D AC 7H 6C 5D QC', + 'TC QD AD 9C QS 5C 8D KD 3D 3C', + '9D 8H AS 3S 7C 8S JD 2D 8D KC', + '4C TH AC QH JS 8D 7D 7S 9C KH', + '9D 8D 4C JH 2C 2S QD KD TS 4H', + '4D 6D 5D 2D JH 3S 8S 3H TC KH', + 'AD 4D 2C QS 8C KD JH JD AH 5C', + '5C 6C 5H 2H JH 4H KS 7C TC 3H', + '3C 4C QC 5D JH 9C QD KH 8D TC', + '3H 9C JS 7H QH AS 7C 9H 5H JC', + '2D 5S QD 4S 3C KC 6S 6C 5C 4C', + '5D KH 2D TS 8S 9C AS 9S 7C 4C', + '7C AH 8C 8D 5S KD QH QS JH 2C', + '8C 9D AH 2H AC QC 5S 8H 7H 2C', + 'QD 9H 5S QS QC 9C 5H JC TH 4H', + '6C 6S 3H 5H 3S 6H KS 8D AC 7S', + 'AC QH 7H 8C 4S KC 6C 3D 3S TC', + '9D 3D JS TH AC 5H 3H 8S 3S TC', + 'QD KH JS KS 9S QC 8D AH 3C AC', + '5H 6C KH 3S 9S JH 2D QD AS 8C', + '6C 4D 7S 7H 5S JC 6S 9H 4H JH', + 'AH 5S 6H 9S AD 3S TH 2H 9D 8C', + '4C 8D 9H 7C QC AD 4S 9C KC 5S', + '9D 6H 4D TC 4C JH 2S 5D 3S AS', + '2H 6C 7C KH 5C AD QS TH JD 8S', + '3S 4S 7S AH AS KC JS 2S AD TH', + 'JS KC 2S 7D 8C 5C 9C TS 5H 9D', + '7S 9S 4D TD JH JS KH 6H 5D 2C', + 'JD JS JC TH 2D 3D QD 8C AC 5H', + '7S KH 5S 9D 5D TD 4S 6H 3C 2D', + '4S 5D AC 8D 4D 7C AD AS AH 9C', + '6S TH TS KS 2C QC AH AS 3C 4S', + '2H 8C 3S JC 5C 7C 3H 3C KH JH', + '7S 3H JC 5S 6H 4C 2S 4D KC 7H', + '4D 7C 4H 9S 8S 6S AD TC 6C JC', + 'KH QS 3S TC 4C 8H 8S AC 3C TS', + 'QD QS TH 3C TS 7H 7D AH TD JC', + 'TD JD QC 4D 9S 7S TS AD 7D AC', + 'AH 7H 4S 6D 7C 2H 9D KS JC TD', + '7C AH JD 4H 6D QS TS 2H 2C 5C', + 'TC KC 8C 9S 4C JS 3C JC 6S AH', + 'AS 7D QC 3D 5S JC JD 9D TD KH', + 'TH 3C 2S 6H AH AC 5H 5C 7S 8H', + 'QC 2D AC QD 2S 3S JD QS 6S 8H', + 'KC 4H 3C 9D JS 6H 3S 8S AS 8C', + '7H KC 7D JD 2H JC QH 5S 3H QS', + '9H TD 3S 8H 7S AC 5C 6C AH 7C', + '8D 9H AH JD TD QS 7D 3S 9C 8S', + 'AH QH 3C JD KC 4S 5S 5D TD KS', + '9H 7H 6S JH TH 4C 7C AD 5C 2D', + '7C KD 5S TC 9D 6S 6C 5D 2S TH', + 'KC 9H 8D 5H 7H 4H QC 3D 7C AS', + '6S 8S QC TD 4S 5C TH QS QD 2S', + '8S 5H TH QC 9H 6S KC 7D 7C 5C', + '7H KD AH 4D KH 5C 4S 2D KC QH', + '6S 2C TD JC AS 4D 6C 8C 4H 5S', + 'JC TC JD 5S 6S 8D AS 9D AD 3S', + '6D 6H 5D 5S TC 3D 7D QS 9D QD', + '4S 6C 8S 3S 7S AD KS 2D 7D 7C', + 'KC QH JC AC QD 5D 8D QS 7H 7D', + 'JS AH 8S 5H 3D TD 3H 4S 6C JH', + '4S QS 7D AS 9H JS KS 6D TC 5C', + '2D 5C 6H TC 4D QH 3D 9H 8S 6C', + '6D 7H TC TH 5S JD 5C 9C KS KD', + '8D TD QH 6S 4S 6C 8S KC 5C TC', + '5S 3D KS AC 4S 7D QD 4C TH 2S', + 'TS 8H 9S 6S 7S QH 3C AH 7H 8C', + '4C 8C TS JS QC 3D 7D 5D 7S JH', + '8S 7S 9D QC AC 7C 6D 2H JH KC', + 'JS KD 3C 6S 4S 7C AH QC KS 5H', + 'KS 6S 4H JD QS TC 8H KC 6H AS', + 'KH 7C TC 6S TD JC 5C 7D AH 3S', + '3H 4C 4H TC TH 6S 7H 6D 9C QH', + '7D 5H 4S 8C JS 4D 3D 8S QH KC', + '3H 6S AD 7H 3S QC 8S 4S 7S JS', + '3S JD KH TH 6H QS 9C 6C 2D QD', + '4S QH 4D 5H KC 7D 6D 8D TH 5S', + 'TD AD 6S 7H KD KH 9H 5S KC JC', + '3H QC AS TS 4S QD KS 9C 7S KC', + 'TS 6S QC 6C TH TC 9D 5C 5D KD', + 'JS 3S 4H KD 4C QD 6D 9S JC 9D', + '8S JS 6D 4H JH 6H 6S 6C KS KH', + 'AC 7D 5D TC 9S KH 6S QD 6H AS', + 'AS 7H 6D QH 8D TH 2S KH 5C 5H', + '4C 7C 3D QC TC 4S KH 8C 2D JS', + '6H 5D 7S 5H 9C 9H JH 8S TH 7H', + 'AS JS 2S QD KH 8H 4S AC 8D 8S', + '3H 4C TD KD 8C JC 5C QS 2D JD', + 'TS 7D 5D 6C 2C QS 2H 3C AH KS', + '4S 7C 9C 7D JH 6C 5C 8H 9D QD', + '2S TD 7S 6D 9C 9S QS KH QH 5C', + 'JC 6S 9C QH JH 8D 7S JS KH 2H', + '8D 5H TH KC 4D 4S 3S 6S 3D QS', + '2D JD 4C TD 7C 6D TH 7S JC AH', + 'QS 7S 4C TH 9D TS AD 4D 3H 6H', + '2D 3H 7D JD 3D AS 2S 9C QC 8S', + '4H 9H 9C 2C 7S JH KD 5C 5D 6H', + 'TC 9H 8H JC 3C 9S 8D KS AD KC', + 'TS 5H JD QS QH QC 8D 5D KH AH', + '5D AS 8S 6S 4C AH QC QD TH 7H', + '3H 4H 7D 6S 4S 9H AS 8H JS 9D', + 'JD 8C 2C 9D 7D 5H 5S 9S JC KD', + 'KD 9C 4S QD AH 7C AD 9D AC TD', + '6S 4H 4S 9C 8D KS TC 9D JH 7C', + '5S JC 5H 4S QH AC 2C JS 2S 9S', + '8C 5H AS QD AD 5C 7D 8S QC TD', + 'JC 4C 8D 5C KH QS 4D 6H 2H 2C', + 'TH 4S 2D KC 3H QD AC 7H AD 9D', + 'KH QD AS 8H TH KC 8D 7S QH 8C', + 'JC 6C 7D 8C KH AD QS 2H 6S 2D', + 'JC KH 2D 7D JS QC 5H 4C 5D AD', + 'TS 3S AD 4S TD 2D TH 6S 9H JH', + '9H 2D QS 2C 4S 3D KH AS AC 9D', + 'KH 6S 8H 4S KD 7D 9D TS QD QC', + 'JH 5H AH KS AS AD JC QC 5S KH', + '5D 7D 6D KS KD 3D 7C 4D JD 3S', + 'AC JS 8D 5H 9C 3H 4H 4D TS 2C', + '6H KS KH 9D 7C 2S 6S 8S 2H 3D', + '6H AC JS 7S 3S TD 8H 3H 4H TH', + '9H TC QC KC 5C KS 6H 4H AC 8S', + 'TC 7D QH 4S JC TS 6D 6C AC KH', + 'QH 7D 7C JH QS QD TH 3H 5D KS', + '3D 5S 8D JS 4C 2C KS 7H 9C 4H', + '5H 8S 4H TD 2C 3S QD QC 3H KC', + 'QC JS KD 9C AD 5S 9D 7D 7H TS', + '8C JC KH 7C 7S 6C TS 2C QD TH', + '5S 9D TH 3C 7S QH 8S 9C 2H 5H', + '5D 9H 6H 2S JS KH 3H 7C 2H 5S', + 'JD 5D 5S 2C TC 2S 6S 6C 3C 8S', + '4D KH 8H 4H 2D KS 3H 5C 2S 9H', + '3S 2D TD 7H 8S 6H JD KC 9C 8D', + '6S QD JH 7C 9H 5H 8S 8H TH TD', + 'QS 7S TD 7D TS JC KD 7C 3C 2C', + '3C JD 8S 4H 2D 2S TD AS 4D AC', + 'AH KS 6C 4C 4S 7D 8C 9H 6H AS', + '5S 3C 9S 2C QS KD 4D 4S AC 5D', + '2D TS 2C JS KH QH 5D 8C AS KC', + 'KD 3H 6C TH 8S 7S KH 6H 9S AC', + '6H 7S 6C QS AH 2S 2H 4H 5D 5H', + '5H JC QD 2C 2S JD AS QC 6S 7D', + '6C TC AS KD 8H 9D 2C 7D JH 9S', + '2H 4C 6C AH 8S TD 3H TH 7C TS', + 'KD 4S TS 6C QH 8D 9D 9C AH 7D', + '6D JS 5C QD QC 9C 5D 8C 2H KD', + '3C QH JH AD 6S AH KC 8S 6D 6H', + '3D 7C 4C 7S 5S 3S 6S 5H JC 3C', + 'QH 7C 5H 3C 3S 8C TS 4C KD 9C', + 'QD 3S 7S 5H 7H QH JC 7C 8C KD', + '3C KD KH 2S 4C TS AC 6S 2C 7C', + '2C KH 3C 4C 6H 4D 5H 5S 7S QD', + '4D 7C 8S QD TS 9D KS 6H KD 3C', + 'QS 4D TS 7S 4C 3H QD 8D 9S TC', + 'TS QH AC 6S 3C 9H 9D QS 8S 6H', + '3S 7S 5D 4S JS 2D 6C QH 6S TH', + '4C 4H AS JS 5D 3D TS 9C AC 8S', + '6S 9C 7C 3S 5C QS AD AS 6H 3C', + '9S 8C 7H 3H 6S 7C AS 9H JD KH', + '3D 3H 7S 4D 6C 7C AC 2H 9C TH', + '4H 5S 3H AC TC TH 9C 9H 9S 8D', + '8D 9H 5H 4D 6C 2H QD 6S 5D 3S', + '4C 5C JD QS 4D 3H TH AC QH 8C', + 'QC 5S 3C 7H AD 4C KS 4H JD 6D', + 'QS AH 3H KS 9H 2S JS JH 5H 2H', + '2H 5S TH 6S TS 3S KS 3C 5H JS', + '2D 9S 7H 3D KC JH 6D 7D JS TD', + 'AC JS 8H 2C 8C JH JC 2D TH 7S', + '5D 9S 8H 2H 3D TC AH JC KD 9C', + '9D QD JC 2H 6D KH TS 9S QH TH', + '2C 8D 4S JD 5H 3H TH TC 9C KC', + 'AS 3D 9H 7D 4D TH KH 2H 7S 3H', + '4H 7S KS 2S JS TS 8S 2H QD 8D', + '5S 6H JH KS 8H 2S QC AC 6S 3S', + 'JC AS AD QS 8H 6C KH 4C 4D QD', + '2S 3D TS TD 9S KS 6S QS 5C 8D', + '3C 6D 4S QC KC JH QD TH KH AD', + '9H AH 4D KS 2S 8D JH JC 7C QS', + '2D 6C TH 3C 8H QD QH 2S 3S KS', + '6H 5D 9S 4C TS TD JS QD 9D JD', + '5H 8H KH 8S KS 7C TD AD 4S KD', + '2C 7C JC 5S AS 6C 7D 8S 5H 9C', + '6S QD 9S TS KH QS 5S QH 3C KC', + '7D 3H 3C KD 5C AS JH 7H 6H JD', + '9D 5C 9H KC 8H KS 4S AD 4D 2S', + '3S JD QD 8D 2S 7C 5S 6S 5H TS', + '6D 9S KC TD 3S 6H QD JD 5C 8D', + '5H 9D TS KD 8D 6H TD QC 4C 7D', + '6D 4S JD 9D AH 9S AS TD 9H QD', + '2D 5S 2H 9C 6H 9S TD QC 7D TC', + '3S 2H KS TS 2C 9C 8S JS 9D 7D', + '3C KC 6D 5D 6C 6H 8S AS 7S QS', + 'JH 9S 2H 8D 4C 8H 9H AD TH KH', + 'QC AS 2S JS 5C 6H KD 3H 7H 2C', + 'QD 8H 2S 8D 3S 6D AH 2C TC 5C', + 'JD JS TS 8S 3H 5D TD KC JC 6H', + '6S QS TC 3H 5D AH JC 7C 7D 4H', + '7C 5D 8H 9C 2H 9H JH KH 5S 2C', + '9C 7H 6S TH 3S QC QD 4C AC JD', + '2H 5D 9S 7D KC 3S QS 2D AS KH', + '2S 4S 2H 7D 5C TD TH QH 9S 4D', + '6D 3S TS 6H 4H KS 9D 8H 5S 2D', + '9H KS 4H 3S 5C 5D KH 6H 6S JS', + 'KC AS 8C 4C JC KH QC TH QD AH', + '6S KH 9S 2C 5H TC 3C 7H JC 4D', + 'JD 4S 6S 5S 8D 7H 7S 4D 4C 2H', + '7H 9H 5D KH 9C 7C TS TC 7S 5H', + '4C 8D QC TS 4S 9H 3D AD JS 7C', + '8C QS 5C 5D 3H JS AH KC 4S 9D', + 'TS JD 8S QS TH JH KH 2D QD JS', + 'JD QC 5D 6S 9H 3S 2C 8H 9S TS', + '2S 4C AD 7H JC 5C 2D 6D 4H 3D', + '7S JS 2C 4H 8C AD QD 9C 3S TD', + 'JD TS 4C 6H 9H 7D QD 6D 3C AS', + 'AS 7C 4C 6S 5D 5S 5C JS QC 4S', + 'KD 6S 9S 7C 3C 5S 7D JH QD JS', + '4S 7S JH 2C 8S 5D 7H 3D QH AD', + 'TD 6H 2H 8D 4H 2D 7C AD KH 5D', + 'TS 3S 5H 2C QD AH 2S 5C KH TD', + 'KC 4D 8C 5D AS 6C 2H 2S 9H 7C', + 'KD JS QC TS QS KH JH 2C 5D AD', + '3S 5H KC 6C 9H 3H 2H AD 7D 7S', + '7S JS JH KD 8S 7D 2S 9H 7C 2H', + '9H 2D 8D QC 6S AD AS 8H 5H 6C', + '2S 7H 6C 6D 7D 8C 5D 9D JC 3C', + '7C 9C 7H JD 2H KD 3S KH AD 4S', + 'QH AS 9H 4D JD KS KD TS KH 5H', + '4C 8H 5S 3S 3D 7D TD AD 7S KC', + 'JS 8S 5S JC 8H TH 9C 4D 5D KC', + '7C 5S 9C QD 2C QH JS 5H 8D KH', + 'TD 2S KS 3D AD KC 7S TC 3C 5D', + '4C 2S AD QS 6C 9S QD TH QH 5C', + '8C AD QS 2D 2S KC JD KS 6C JC', + '8D 4D JS 2H 5D QD 7S 7D QH TS', + '6S 7H 3S 8C 8S 9D QS 8H 6C 9S', + '4S TC 2S 5C QD 4D QS 6D TH 6S', + '3S 5C 9D 6H 8D 4C 7D TC 7C TD', + 'AH 6S AS 7H 5S KD 3H 5H AC 4C', + '8D 8S AH KS QS 2C AD 6H 7D 5D', + '6H 9H 9S 2H QS 8S 9C 5D 2D KD', + 'TS QC 5S JH 7D 7S TH 9S 9H AC', + '7H 3H 6S KC 4D 6D 5C 4S QD TS', + 'TD 2S 7C QD 3H JH 9D 4H 7S 7H', + 'KS 3D 4H 5H TC 2S AS 2D 6D 7D', + '8H 3C 7H TD 3H AD KC TH 9C KH', + 'TC 4C 2C 9S 9D 9C 5C 2H JD 3C', + '3H AC TS 5D AD 8D 6H QC 6S 8C', + '2S TS 3S JD 7H 8S QH 4C 5S 8D', + 'AC 4S 6C 3C KH 3D 7C 2D 8S 2H', + '4H 6C 8S TH 2H 4S 8H 9S 3H 7S', + '7C 4C 9C 2C 5C AS 5D KD 4D QH', + '9H 4H TS AS 7D 8D 5D 9S 8C 2H', + 'QC KD AC AD 2H 7S AS 3S 2D 9S', + '2H QC 8H TC 6D QD QS 5D KH 3C', + 'TH JD QS 4C 2S 5S AD 7H 3S AS', + '7H JS 3D 6C 3S 6D AS 9S AC QS', + '9C TS AS 8C TC 8S 6H 9D 8D 6C', + '4D JD 9C KC 7C 6D KS 3S 8C AS', + '3H 6S TC 8D TS 3S KC 9S 7C AS', + '8C QC 4H 4S 8S 6C 3S TC AH AC', + '4D 7D 5C AS 2H 6S TS QC AD TC', + 'QD QC 8S 4S TH 3D AH TS JH 4H', + '5C 2D 9S 2C 3H 3C 9D QD QH 7D', + 'KC 9H 6C KD 7S 3C 4D AS TC 2D', + '3D JS 4D 9D KS 7D TH QC 3H 3C', + '8D 5S 2H 9D 3H 8C 4C 4H 3C TH', + 'JC TH 4S 6S JD 2D 4D 6C 3D 4C', + 'TS 3S 2D 4H AC 2C 6S 2H JH 6H', + 'TD 8S AD TC AH AC JH 9S 6S 7S', + '6C KC 4S JD 8D 9H 5S 7H QH AH', + 'KD 8D TS JH 5C 5H 3H AD AS JS', + '2D 4H 3D 6C 8C 7S AD 5D 5C 8S', + 'TD 5D 7S 9C 4S 5H 6C 8C 4C 8S', + 'JS QH 9C AS 5C QS JC 3D QC 7C', + 'JC 9C KH JH QS QC 2C TS 3D AD', + '5D JH AC 5C 9S TS 4C JD 8C KS', + 'KC AS 2D KH 9H 2C 5S 4D 3D 6H', + 'TH AH 2D 8S JC 3D 8C QH 7S 3S', + '8H QD 4H JC AS KH KS 3C 9S 6D', + '9S QH 7D 9C 4S AC 7H KH 4D KD', + 'AH AD TH 6D 9C 9S KD KS QH 4H', + 'QD 6H 9C 7C QS 6D 6S 9D 5S JH', + 'AH 8D 5H QD 2H JC KS 4H KH 5S', + '5C 2S JS 8D 9C 8C 3D AS KC AH', + 'JD 9S 2H QS 8H 5S 8C TH 5C 4C', + 'QC QS 8C 2S 2C 3S 9C 4C KS KH', + '2D 5D 8S AH AD TD 2C JS KS 8C', + 'TC 5S 5H 8H QC 9H 6H JD 4H 9S', + '3C JH 4H 9H AH 4S 2H 4C 8D AC', + '8S TH 4D 7D 6D QD QS 7S TC 7C', + 'KH 6D 2D JD 5H JS QD JH 4H 4S', + '9C 7S JH 4S 3S TS QC 8C TC 4H', + 'QH 9D 4D JH QS 3S 2C 7C 6C 2D', + '4H 9S JD 5C 5H AH 9D TS 2D 4C', + 'KS JH TS 5D 2D AH JS 7H AS 8D', + 'JS AH 8C AD KS 5S 8H 2C 6C TH', + '2H 5D AD AC KS 3D 8H TS 6H QC', + '6D 4H TS 9C 5H JS JH 6S JD 4C', + 'JH QH 4H 2C 6D 3C 5D 4C QS KC', + '6H 4H 6C 7H 6S 2S 8S KH QC 8C', + '3H 3D 5D KS 4H TD AD 3S 4D TS', + '5S 7C 8S 7D 2C KS 7S 6C 8C JS', + '5D 2H 3S 7C 5C QD 5H 6D 9C 9H', + 'JS 2S KD 9S 8D TD TS AC 8C 9D', + '5H QD 2S AC 8C 9H KS 7C 4S 3C', + 'KH AS 3H 8S 9C JS QS 4S AD 4D', + 'AS 2S TD AD 4D 9H JC 4C 5H QS', + '5D 7C 4H TC 2D 6C JS 4S KC 3S', + '4C 2C 5D AC 9H 3D JD 8S QS QH', + '2C 8S 6H 3C QH 6D TC KD AC AH', + 'QC 6C 3S QS 4S AC 8D 5C AD KH', + '5S 4C AC KH AS QC 2C 5C 8D 9C', + '8H JD 3C KH 8D 5C 9C QD QH 9D', + '7H TS 2C 8C 4S TD JC 9C 5H QH', + 'JS 4S 2C 7C TH 6C AS KS 7S JD', + 'JH 7C 9H 7H TC 5H 3D 6D 5D 4D', + '2C QD JH 2H 9D 5S 3D TD AD KS', + 'JD QH 3S 4D TH 7D 6S QS KS 4H', + 'TC KS 5S 8D 8H AD 2S 2D 4C JH', + '5S JH TC 3S 2D QS 9D 4C KD 9S', + 'AC KH 3H AS 9D KC 9H QD 6C 6S', + '9H 7S 3D 5C 7D KC TD 8H 4H 6S', + '3C 7H 8H TC QD 4D 7S 6S QH 6C', + '6D AD 4C QD 6C 5D 7D 9D KS TS', + 'JH 2H JD 9S 7S TS KH 8D 5D 8H', + '2D 9S 4C 7D 9D 5H QD 6D AC 6S', + '7S 6D JC QD JH 4C 6S QS 2H 7D', + '8C TD JH KD 2H 5C QS 2C JS 7S', + 'TC 5H 4H JH QD 3S 5S 5D 8S KH', + 'KS KH 7C 2C 5D JH 6S 9C 6D JC', + '5H AH JD 9C JS KC 2H 6H 4D 5S', + 'AS 3C TH QC 6H 9C 8S 8C TD 7C', + 'KC 2C QD 9C KH 4D 7S 3C TS 9H', + '9C QC 2S TS 8C TD 9S QD 3S 3C', + '4D 9D TH JH AH 6S 2S JD QH JS', + 'QD 9H 6C KD 7D 7H 5D 6S 8H AH', + '8H 3C 4S 2H 5H QS QH 7S 4H AC', + 'QS 3C 7S 9S 4H 3S AH KS 9D 7C', + 'AD 5S 6S 2H 2D 5H TC 4S 3C 8C', + 'QH TS 6S 4D JS KS JH AS 8S 6D', + '2C 8S 2S TD 5H AS TC TS 6C KC', + 'KC TS 8H 2H 3H 7C 4C 5S TH TD', + 'KD AD KH 7H 7S 5D 5H 5S 2D 9C', + 'AD 9S 3D 7S 8C QC 7C 9C KD KS', + '3C QC 9S 8C 4D 5C AS QD 6C 2C', + '2H KC 8S JD 7S AC 8D 5C 2S 4D', + '9D QH 3D 2S TC 3S KS 3C 9H TD', + 'KD 6S AC 2C 7H 5H 3S 6C 6H 8C', + 'QH TC 8S 6S KH TH 4H 5D TS 4D', + '8C JS 4H 6H 2C 2H 7D AC QD 3D', + 'QS KC 6S 2D 5S 4H TD 3H JH 4C', + '7S 5H 7H 8H KH 6H QS TH KD 7D', + '5H AD KD 7C KH 5S TD 6D 3C 6C', + '8C 9C 5H JD 7C KC KH 7H 2H 3S', + '7S 4H AD 4D 8S QS TH 3D 7H 5S', + '8D TC KS KD 9S 6D AD JD 5C 2S', + '7H 8H 6C QD 2H 6H 9D TC 9S 7C', + '8D 6D 4C 7C 6C 3C TH KH JS JH', + '5S 3S 8S JS 9H AS AD 8H 7S KD', + 'JH 7C 2C KC 5H AS AD 9C 9S JS', + 'AD AC 2C 6S QD 7C 3H TH KS KD', + '9D JD 4H 8H 4C KH 7S TS 8C KC', + '3S 5S 2H 7S 6H 7D KS 5C 6D AD', + '5S 8C 9H QS 7H 7S 2H 6C 7D TD', + 'QS 5S TD AC 9D KC 3D TC 2D 4D', + 'TD 2H 7D JD QD 4C 7H 5D KC 3D', + '4C 3H 8S KD QH 5S QC 9H TC 5H', + '9C QD TH 5H TS 5C 9H AH QH 2C', + '4D 6S 3C AC 6C 3D 2C 2H TD TH', + 'AC 9C 5D QC 4D AD 8D 6D 8C KC', + 'AD 3C 4H AC 8D 8H 7S 9S TD JC', + '4H 9H QH JS 2D TH TD TC KD KS', + '5S 6S 9S 8D TH AS KH 5H 5C 8S', + 'JD 2S 9S 6S 5S 8S 5D 7S 7H 9D', + '5D 8C 4C 9D AD TS 2C 7D KD TC', + '8S QS 4D KC 5C 8D 4S KH JD KD', + 'AS 5C AD QH 7D 2H 9S 7H 7C TC', + '2S 8S JD KH 7S 6C 6D AD 5D QC', + '9H 6H 3S 8C 8H AH TC 4H JS TD', + '2C TS 4D 7H 2D QC 9C 5D TH 7C', + '6C 8H QC 5D TS JH 5C 5H 9H 4S', + '2D QC 7H AS JS 8S 2H 4C 4H 8D', + 'JS 6S AC KD 3D 3C 4S 7H TH KC', + 'QH KH 6S QS 5S 4H 3C QD 3S 3H', + '7H AS KH 8C 4H 9C 5S 3D 6S TS', + '9C 7C 3H 5S QD 2C 3D AD AC 5H', + 'JH TD 2D 4C TS 3H KH AD 3S 7S', + 'AS 4C 5H 4D 6S KD JC 3C 6H 2D', + '3H 6S 8C 2D TH 4S AH QH AD 5H', + '7C 2S 9H 7H KC 5C 6D 5S 3H JC', + '3C TC 9C 4H QD TD JH 6D 9H 5S', + '7C 6S 5C 5D 6C 4S 7H 9H 6H AH', + 'AD 2H 7D KC 2C 4C 2S 9S 7H 3S', + 'TH 4C 8S 6S 3S AD KS AS JH TD', + '5C TD 4S 4D AD 6S 5D TC 9C 7D', + '8H 3S 4D 4S 5S 6H 5C AC 3H 3D', + '9H 3C AC 4S QS 8S 9D QH 5H 4D', + 'JC 6C 5H TS AC 9C JD 8C 7C QD', + '8S 8H 9C JD 2D QC QH 6H 3C 8D', + 'KS JS 2H 6H 5H QH QS 3H 7C 6D', + 'TC 3H 4S 7H QC 2H 3S 8C JS KH', + 'AH 8H 5S 4C 9H JD 3H 7S JC AC', + '3C 2D 4C 5S 6C 4S QS 3S JD 3D', + '5H 2D TC AH KS 6D 7H AD 8C 6H', + '6C 7S 3C JD 7C 8H KS KH AH 6D', + 'AH 7D 3H 8H 8S 7H QS 5H 9D 2D', + 'JD AC 4H 7S 8S 9S KS AS 9D QH', + '7S 2C 8S 5S JH QS JC AH KD 4C', + 'AH 2S 9H 4H 8D TS TD 6H QH JD', + '4H JC 3H QS 6D 7S 9C 8S 9D 8D', + '5H TD 4S 9S 4C 8C 8D 7H 3H 3D', + 'QS KH 3S 2C 2S 3C 7S TD 4S QD', + '7C TD 4D 5S KH AC AS 7H 4C 6C', + '2S 5H 6D JD 9H QS 8S 2C 2H TD', + '2S TS 6H 9H 7S 4H JC 4C 5D 5S', + '2C 5H 7D 4H 3S QH JC JS 6D 8H', + '4C QH 7C QD 3S AD TH 8S 5S TS', + '9H TC 2S TD JC 7D 3S 3D TH QH', + '7D 4C 8S 5C JH 8H 6S 3S KC 3H', + 'JC 3H KH TC QH TH 6H 2C AC 5H', + 'QS 2H 9D 2C AS 6S 6C 2S 8C 8S', + '9H 7D QC TH 4H KD QS AC 7S 3C', + '4D JH 6S 5S 8H KS 9S QC 3S AS', + 'JD 2D 6S 7S TC 9H KC 3H 7D KD', + '2H KH 7C 4D 4S 3H JS QD 7D KC', + '4C JC AS 9D 3C JS 6C 8H QD 4D', + 'AH JS 3S 6C 4C 3D JH 6D 9C 9H', + '9H 2D 8C 7H 5S KS 6H 9C 2S TC', + '6C 8C AD 7H 6H 3D KH AS 5D TH', + 'KS 8C 3S TS 8S 4D 5S 9S 6C 4H', + '9H 4S 4H 5C 7D KC 2D 2H 9D JH', + '5C JS TC 9D 9H 5H 7S KH JC 6S', + '7C 9H 8H 4D JC KH JD 2H TD TC', + '8H 6C 2H 2C KH 6H 9D QS QH 5H', + 'AC 7D 2S 3D QD JC 2D 8D JD JH', + '2H JC 2D 7H 2C 3C 8D KD TD 4H', + '3S 4H 6D 8D TS 3H TD 3D 6H TH', + 'JH JC 3S AC QH 9H 7H 8S QC 2C', + '7H TD QS 4S 8S 9C 2S 5D 4D 2H', + '3D TS 3H 2S QC 8H 6H KC JC KS', + '5D JD 7D TC 8C 6C 9S 3D 8D AC', + '8H 6H JH 6C 5D 8D 8S 4H AD 2C', + '9D 4H 2D 2C 3S TS AS TC 3C 5D', + '4D TH 5H KS QS 6C 4S 2H 3D AD', + '5C KC 6H 2C 5S 3C 4D 2D 9H 9S', + 'JD 4C 3H TH QH 9H 5S AH 8S AC', + '7D 9S 6S 2H TD 9C 4H 8H QS 4C', + '3C 6H 5D 4H 8C 9C KC 6S QD QS', + '3S 9H KD TC 2D JS 8C 6S 4H 4S', + '2S 4C 8S QS 6H KH 3H TH 8C 5D', + '2C KH 5S 3S 7S 7H 6C 9D QD 8D', + '8H KS AC 2D KH TS 6C JS KC 7H', + '9C KS 5C TD QC AH 6C 5H 9S 7C', + '5D 4D 3H 4H 6S 7C 7S AH QD TD', + '2H 7D QC 6S TC TS AH 7S 9D 3H', + 'TH 5H QD 9S KS 7S 7C 6H 8C TD', + 'TH 2D 4D QC 5C 7D JD AH 9C 4H', + '4H 3H AH 8D 6H QC QH 9H 2H 2C', + '2D AD 4C TS 6H 7S TH 4H QS TD', + '3C KD 2H 3H QS JD TC QC 5D 8H', + 'KS JC QD TH 9S KD 8D 8C 2D 9C', + '3C QD KD 6D 4D 8D AH AD QC 8S', + '8H 3S 9D 2S 3H KS 6H 4C 7C KC', + 'TH 9S 5C 3D 7D 6H AC 7S 4D 2C', + '5C 3D JD 4D 2D 6D 5H 9H 4C KH', + 'AS 7H TD 6C 2H 3D QD KS 4C 4S', + 'JC 3C AC 7C JD JS 8H 9S QC 5D', + 'JD 6S 5S 2H AS 8C 7D 5H JH 3D', + '8D TC 5S 9S 8S 3H JC 5H 7S AS', + '5C TD 3D 7D 4H 8D 7H 4D 5D JS', + 'QS 9C KS TD 2S 8S 5C 2H 4H AS', + 'TH 7S 4H 7D 3H JD KD 5D 2S KC', + 'JD 7H 4S 8H 4C JS 6H QH 5S 4H', + '2C QS 8C 5S 3H QC 2S 6C QD AD', + '8C 3D JD TC 4H 2H AD 5S AC 2S', + '5D 2C JS 2D AD 9D 3D 4C 4S JH', + '8D 5H 5D 6H 7S 4D KS 9D TD JD', + '3D 6D 9C 2S AS 7D 5S 5C 8H JD', + '7C 8S 3S 6S 5H JD TC AD 7H 7S', + '2S 9D TS 4D AC 8D 6C QD JD 3H', + '9S KH 2C 3C AC 3D 5H 6H 8D 5D', + 'KS 3D 2D 6S AS 4C 2S 7C 7H KH', + 'AC 2H 3S JC 5C QH 4D 2D 5H 7S', + 'TS AS JD 8C 6H JC 8S 5S 2C 5D', + '7S QH 7H 6C QC 8H 2D 7C JD 2S', + '2C QD 2S 2H JC 9C 5D 2D JD JH', + '7C 5C 9C 8S 7D 6D 8D 6C 9S JH', + '2C AD 6S 5H 3S KS 7S 9D KH 4C', + '7H 6C 2C 5C TH 9D 8D 3S QC AH', + '5S KC 6H TC 5H 8S TH 6D 3C AH', + '9C KD 4H AD TD 9S 4S 7D 6H 5D', + '7H 5C 5H 6D AS 4C KD KH 4H 9D', + '3C 2S 5C 6C JD QS 2H 9D 7D 3H', + 'AC 2S 6S 7S JS QD 5C QS 6H AD', + '5H TH QC 7H TC 3S 7C 6D KC 3D', + '4H 3D QC 9S 8H 2C 3S JC KS 5C', + '4S 6S 2C 6H 8S 3S 3D 9H 3H JS', + '4S 8C 4D 2D 8H 9H 7D 9D AH TS', + '9S 2C 9H 4C 8D AS 7D 3D 6D 5S', + '6S 4C 7H 8C 3H 5H JC AH 9D 9C', + '2S 7C 5S JD 8C 3S 3D 4D 7D 6S', + '3C KC 4S 5D 7D 3D JD 7H 3H 4H', + '9C 9H 4H 4D TH 6D QD 8S 9S 7S', + '2H AC 8S 4S AD 8C 2C AH 7D TC', + 'TS 9H 3C AD KS TC 3D 8C 8H JD', + 'QC 8D 2C 3C 7D 7C JD 9H 9C 6C', + 'AH 6S JS JH 5D AS QC 2C JD TD', + '9H KD 2H 5D 2D 3S 7D TC AH TS', + 'TD 8H AS 5D AH QC AC 6S TC 5H', + 'KS 4S 7H 4D 8D 9C TC 2H 6H 3H', + '3H KD 4S QD QH 3D 8H 8C TD 7S', + '8S JD TC AH JS QS 2D KH KS 4D', + '3C AD JC KD JS KH 4S TH 9H 2C', + 'QC 5S JS 9S KS AS 7C QD 2S JD', + 'KC 5S QS 3S 2D AC 5D 9H 8H KS', + '6H 9C TC AD 2C 6D 5S JD 6C 7C', + 'QS KH TD QD 2C 3H 8S 2S QC AH', + '9D 9H JH TC QH 3C 2S JS 5C 7H', + '6C 3S 3D 2S 4S QD 2D TH 5D 2C', + '2D 6H 6D 2S JC QH AS 7H 4H KH', + '5H 6S KS AD TC TS 7C AC 4S 4H', + 'AD 3C 4H QS 8C 9D KS 2H 2D 4D', + '4S 9D 6C 6D 9C AC 8D 3H 7H KD', + 'JC AH 6C TS JD 6D AD 3S 5D QD', + 'JC JH JD 3S 7S 8S JS QC 3H 4S', + 'JD TH 5C 2C AD JS 7H 9S 2H 7S', + '8D 3S JH 4D QC AS JD 2C KC 6H', + '2C AC 5H KD 5S 7H QD JH AH 2D', + 'JC QH 8D 8S TC 5H 5C AH 8C 6C', + '3H JS 8S QD JH 3C 4H 6D 5C 3S', + '6D 4S 4C AH 5H 5S 3H JD 7C 8D', + '8H AH 2H 3H JS 3C 7D QC 4H KD', + '6S 2H KD 5H 8H 2D 3C 8S 7S QD', + '2S 7S KC QC AH TC QS 6D 4C 8D', + '5S 9H 2C 3S QD 7S 6C 2H 7C 9D', + '3C 6C 5C 5S JD JC KS 3S 5D TS', + '7C KS 6S 5S 2S 2D TC 2H 5H QS', + 'AS 7H 6S TS 5H 9S 9D 3C KD 2H', + '4S JS QS 3S 4H 7C 2S AC 6S 9D', + '8C JH 2H 5H 7C 5D QH QS KH QC', + '3S TD 3H 7C KC 8D 5H 8S KH 8C', + '4H KH JD TS 3C 7H AS QC JS 5S', + 'AH 9D 2C 8D 4D 2D 6H 6C KC 6S', + '2S 6H 9D 3S 7H 4D KH 8H KD 3D', + '9C TC AC JH KH 4D JD 5H TD 3S', + '7S 4H 9D AS 4C 7D QS 9S 2S KH', + '3S 8D 8S KS 8C JC 5C KH 2H 5D', + '8S QH 2C 4D KC JS QC 9D AC 6H', + '8S 8C 7C JS JD 6S 4C 9C AC 4S', + 'QH 5D 2C 7D JC 8S 2D JS JH 4C', + 'JS 4C 7S TS JH KC KH 5H QD 4S', + 'QD 8C 8D 2D 6S TD 9D AC QH 5S', + 'QH QC JS 3D 3C 5C 4H KH 8S 7H', + '7C 2C 5S JC 8S 3H QC 5D 2H KC', + '5S 8D KD 6H 4H QD QH 6D AH 3D', + '7S KS 6C 2S 4D AC QS 5H TS JD', + '7C 2D TC 5D QS AC JS QC 6C KC', + '2C KS 4D 3H TS 8S AD 4H 7S 9S', + 'QD 9H QH 5H 4H 4D KH 3S JC AD', + '4D AC KC 8D 6D 4C 2D KH 2C JD', + '2C 9H 2D AH 3H 6D 9C 7D TC KS', + '8C 3H KD 7C 5C 2S 4S 5H AS AH', + 'TH JD 4H KD 3H TC 5C 3S AC KH', + '6D 7H AH 7S QC 6H 2D TD JD AS', + 'JH 5D 7H TC 9S 7D JC AS 5S KH', + '2H 8C AD TH 6H QD KD 9H 6S 6C', + 'QH KC 9D 4D 3S JS JH 4H 2C 9H', + 'TC 7H KH 4H JC 7D 9S 3H QS 7S', + 'AD 7D JH 6C 7H 4H 3S 3H 4D QH', + 'JD 2H 5C AS 6C QC 4D 3C TC JH', + 'AC JD 3H 6H 4C JC AD 7D 7H 9H', + '4H TC TS 2C 8C 6S KS 2H JD 9S', + '4C 3H QS QC 9S 9H 6D KC 9D 9C', + '5C AD 8C 2C QH TH QD JC 8D 8H', + 'QC 2C 2S QD 9C 4D 3S 8D JH QS', + '9D 3S 2C 7S 7C JC TD 3C TC 9H', + '3C TS 8H 5C 4C 2C 6S 8D 7C 4H', + 'KS 7H 2H TC 4H 2C 3S AS AH QS', + '8C 2D 2H 2C 4S 4C 6S 7D 5S 3S', + 'TH QC 5D TD 3C QS KD KC KS AS', + '4D AH KD 9H KS 5C 4C 6H JC 7S', + 'KC 4H 5C QS TC 2H JC 9S AH QH', + '4S 9H 3H 5H 3C QD 2H QC JH 8H', + '5D AS 7H 2C 3D JH 6H 4C 6S 7D', + '9C JD 9H AH JS 8S QH 3H KS 8H', + '3S AC QC TS 4D AD 3D AH 8S 9H', + '7H 3H QS 9C 9S 5H JH JS AH AC', + '8D 3C JD 2H AC 9C 7H 5S 4D 8H', + '7C JH 9H 6C JS 9S 7H 8C 9D 4H', + '2D AS 9S 6H 4D JS JH 9H AD QD', + '6H 7S JH KH AH 7H TD 5S 6S 2C', + '8H JH 6S 5H 5S 9D TC 4C QC 9S', + '7D 2C KD 3H 5H AS QD 7H JS 4D', + 'TS QH 6C 8H TH 5H 3C 3H 9C 9D', + 'AD KH JS 5D 3H AS AC 9S 5C KC', + '2C KH 8C JC QS 6D AH 2D KC TC', + '9D 3H 2S 7C 4D 6D KH KS 8D 7D', + '9H 2S TC JH AC QC 3H 5S 3S 8H', + '3S AS KD 8H 4C 3H 7C JH QH TS', + '7S 6D 7H 9D JH 4C 3D 3S 6C AS', + '4S 2H 2C 4C 8S 5H KC 8C QC QD', + '3H 3S 6C QS QC 2D 6S 5D 2C 9D', + '2H 8D JH 2S 3H 2D 6C 5C 7S AD', + '9H JS 5D QH 8S TS 2H 7S 6S AD', + '6D QC 9S 7H 5H 5C 7D KC JD 4H', + 'QC 5S 9H 9C 4D 6S KS 2S 4C 7C', + '9H 7C 4H 8D 3S 6H 5C 8H JS 7S', + '2D 6H JS TD 4H 4D JC TH 5H KC', + 'AC 7C 8D TH 3H 9S 2D 4C KC 4D', + 'KD QS 9C 7S 3D KS AD TS 4C 4H', + 'QH 9C 8H 2S 7D KS 7H 5D KD 4C', + '9C 2S 2H JC 6S 6C TC QC JH 5C', + '7S AC 8H KC 8S 6H QS JC 3D 6S', + 'JS 2D JH 8C 4S 6H 8H 6D 5D AD', + '6H 7D 2S 4H 9H 7C AS AC 8H 5S', + '3C JS 4S 6D 5H 2S QH 6S 9C 2C', + '3D 5S 6S 9S 4C QS 8D QD 8S TC', + '9C 3D AH 9H 5S 2C 7D AD JC 3S', + '7H TC AS 3C 6S 6D 7S KH KC 9H', + '3S TC 8H 6S 5H JH 8C 7D AC 2S', + 'QD 9D 9C 3S JC 8C KS 8H 5D 4D', + 'JS AH JD 6D 9D 8C 9H 9S 8H 3H', + '2D 6S 4C 4D 8S AD 4S TC AH 9H', + 'TS AC QC TH KC 6D 4H 7S 8C 2H', + '3C QD JS 9D 5S JC AH 2H TS 9H', + '3H 4D QH 5D 9C 5H 7D 4S JC 3S', + '8S TH 3H 7C 2H JD JS TS AC 8D', + '9C 2H TD KC JD 2S 8C 5S AD 2C', + '3D KD 7C 5H 4D QH QD TC 6H 7D', + '7H 2C KC 5S KD 6H AH QC 7S QH', + '6H 5C AC 5H 2C 9C 2D 7C TD 2S', + '4D 9D AH 3D 7C JD 4H 8C 4C KS', + 'TH 3C JS QH 8H 4C AS 3D QS QC', + '4D 7S 5H JH 6D 7D 6H JS KH 3C', + 'QD 8S 7D 2H 2C 7C JC 2S 5H 8C', + 'QH 8S 9D TC 2H AD 7C 8D QD 6S', + '3S 7C AD 9H 2H 9S JD TS 4C 2D', + '3S AS 4H QC 2C 8H 8S 7S TD TC', + 'JH TH TD 3S 4D 4H 5S 5D QS 2C', + '8C QD QH TC 6D 4S 9S 9D 4H QC', + '8C JS 9D 6H JD 3H AD 6S TD QC', + 'KC 8S 3D 7C TD 7D 8D 9H 4S 3S', + '6C 4S 3D 9D KD TC KC KS AC 5S', + '7C 6S QH 3D JS KD 6H 6D 2D 8C', + 'JD 2S 5S 4H 8S AC 2D 6S TS 5C', + '5H 8C 5S 3C 4S 3D 7C 8D AS 3H', + 'AS TS 7C 3H AD 7D JC QS 6C 6H', + '3S 9S 4C AC QH 5H 5D 9H TS 4H', + '6C 5C 7H 7S TD AD JD 5S 2H 2S', + '7D 6C KC 3S JD 8D 8S TS QS KH', + '8S QS 8D 6C TH AC AH 2C 8H 9S', + '7H TD KH QH 8S 3D 4D AH JD AS', + 'TS 3D 2H JC 2S JH KH 6C QC JS', + 'KC TH 2D 6H 7S 2S TC 8C 9D QS', + '3C 9D 6S KH 8H 6D 5D TH 2C 2H', + '6H TC 7D AD 4D 8S TS 9H TD 7S', + 'JS 6D JD JC 2H AC 6C 3D KH 8D', + 'KH JD 9S 5D 4H 4C 3H 7S QS 5C', + '4H JD 5D 3S 3C 4D KH QH QS 7S', + 'JD TS 8S QD AH 4C 6H 3S 5S 2C', + 'QS 3D JD AS 8D TH 7C 6S QC KS', + '7S 2H 8C QC 7H AC 6D 2D TH KH', + '5S 6C 7H KH 7D AH 8C 5C 7S 3D', + '3C KD AD 7D 6C 4D KS 2D 8C 4S', + '7C 8D 5S 2D 2S AH AD 2C 9D TD', + '3C AD 4S KS JH 7C 5C 8C 9C TH', + 'AS TD 4D 7C JD 8C QH 3C 5H 9S', + '3H 9C 8S 9S 6S QD KS AH 5H JH', + 'QC 9C 5S 4H 2H TD 7D AS 8C 9D', + '8C 2C 9D KD TC 7S 3D KH QC 3C', + '4D AS 4C QS 5S 9D 6S JD QH KS', + '6D AH 6C 4C 5H TS 9H 7D 3D 5S', + 'QS JD 7C 8D 9C AC 3S 6S 6C KH', + '8H JH 5D 9S 6D AS 6S 3S QC 7H', + 'QD AD 5C JH 2H AH 4H AS KC 2C', + 'JH 9C 2C 6H 2D JS 5D 9H KC 6D', + '7D 9D KD TH 3H AS 6S QC 6H AD', + 'JD 4H 7D KC 3H JS 3C TH 3D QS', + '4C 3H 8C QD 5H 6H AS 8H AD JD', + 'TH 8S KD 5D QC 7D JS 5S 5H TS', + '7D KC 9D QS 3H 3C 6D TS 7S AH', + '7C 4H 7H AH QC AC 4D 5D 6D TH', + '3C 4H 2S KD 8H 5H JH TC 6C JD', + '4S 8C 3D 4H JS TD 7S JH QS KD', + '7C QC KD 4D 7H 6S AD TD TC KH', + '5H 9H KC 3H 4D 3D AD 6S QD 6H', + 'TH 7C 6H TS QH 5S 2C KC TD 6S', + '7C 4D 5S JD JH 7D AC KD KH 4H', + '7D 6C 8D 8H 5C JH 8S QD TH JD', + '8D 7D 6C 7C 9D KD AS 5C QH JH', + '9S 2C 8C 3C 4C KS JH 2D 8D 4H', + '7S 6C JH KH 8H 3H 9D 2D AH 6D', + '4D TC 9C 8D 7H TD KS TH KD 3C', + 'JD 9H 8D QD AS KD 9D 2C 2S 9C', + '8D 3H 5C 7H KS 5H QH 2D 8C 9H', + '2D TH 6D QD 6C KC 3H 3S AD 4C', + '4H 3H JS 9D 3C TC 5H QH QC JC', + '3D 5C 6H 3S 3C JC 5S 7S 2S QH', + 'AC 5C 8C 4D 5D 4H 2S QD 3C 3H', + '2C TD AH 9C KD JS 6S QD 4C QC', + 'QS 8C 3S 4H TC JS 3H 7C JC AD', + '5H 4D 9C KS JC TD 9S TS 8S 9H', + 'QD TS 7D AS AC 2C TD 6H 8H AH', + '6S AD 8C 4S 9H 8D 9D KH 8S 3C', + 'QS 4D 2D 7S KH JS JC AD 4C 3C', + 'QS 9S 7H KC TD TH 5H JS AC JH', + '6D AC 2S QS 7C AS KS 6S KH 5S', + '6D 8H KH 3C QS 2H 5C 9C 9D 6C', + 'JS 2C 4C 6H 7D JC AC QD TD 3H', + '4H QC 8H JD 4C KD KS 5C KC 7S', + '6D 2D 3H 2S QD 5S 7H AS TH 6S', + 'AS 6D 8D 2C 8S TD 8H QD JC AH', + '9C 9H 2D TD QH 2H 5C TC 3D 8H', + 'KC 8S 3D KH 2S TS TC 6S 4D JH', + '9H 9D QS AC KC 6H 5D 4D 8D AH', + '9S 5C QS 4H 7C 7D 2H 8S AD JS', + '3D AC 9S AS 2C 2D 2H 3H JC KH', + '7H QH KH JD TC KS 5S 8H 4C 8D', + '2H 7H 3S 2S 5H QS 3C AS 9H KD', + 'AD 3D JD 6H 5S 9C 6D AC 9S 3S', + '3D 5D 9C 2D AC 4S 2S AD 6C 6S', + 'QC 4C 2D 3H 6S KC QH QD 2H JH', + 'QC 3C 8S 4D 9S 2H 5C 8H QS QD', + '6D KD 6S 7H 3S KH 2H 5C JC 6C', + '3S 9S TC 6S 8H 2D AD 7S 8S TS', + '3C 6H 9C 3H 5C JC 8H QH TD QD', + '3C JS QD 5D TD 2C KH 9H TH AS', + '9S TC JD 3D 5C 5H AD QH 9H KC', + 'TC 7H 4H 8H 3H TD 6S AC 7C 2S', + 'QS 9D 5D 3C JC KS 4D 6C JH 2S', + '9S 6S 3C 7H TS 4C KD 6D 3D 9C', + '2D 9H AH AC 7H 2S JH 3S 7C QC', + 'QD 9H 3C 2H AC AS 8S KD 8C KH', + '2D 7S TD TH 6D JD 8D 4D 2H 5S', + '8S QH KD JD QS JH 4D KC 5H 3S', + '3C KH QC 6D 8H 3S AH 7D TD 2D', + '5S 9H QH 4S 6S 6C 6D TS TH 7S', + '6C 4C 6D QS JS 9C TS 3H 8D 8S', + 'JS 5C 7S AS 2C AH 2H AD 5S TC', + 'KD 6C 9C 9D TS 2S JC 4H 2C QD', + 'QS 9H TC 3H KC KS 4H 3C AD TH', + 'KH 9C 2H KD 9D TC 7S KC JH 2D', + '7C 3S KC AS 8C 5D 9C 9S QH 3H', + '2D 8C TD 4C 2H QC 5D TC 2C 7D', + 'KS 4D 6C QH TD KH 5D 7C AD 8D', + '2S 9S 8S 4C 8C 3D 6H QD 7C 7H', + '6C 8S QH 5H TS 5C 3C 4S 2S 2H', + '8S 6S 2H JC 3S 3H 9D 8C 2S 7H', + 'QC 2C 8H 9C AC JD 4C 4H 6S 3S', + '3H 3S 7D 4C 9S 5H 8H JC 3D TC', + 'QH 2S 2D 9S KD QD 9H AD 6D 9C', + '8D 2D KS 9S JC 4C JD KC 4S TH', + 'KH TS 6D 4D 5C KD 5H AS 9H AD', + 'QD JS 7C 6D 5D 5C TH 5H QH QS', + '9D QH KH 5H JH 4C 4D TC TH 6C', + 'KH AS TS 9D KD 9C 7S 4D 8H 5S', + 'KH AS 2S 7D 9D 4C TS TH AH 7C', + 'KS 4D AC 8S 9S 8D TH QH 9D 5C', + '5D 5C 8C QS TC 4C 3D 3S 2C 8D', + '9D KS 2D 3C KC 4S 8C KH 6C JC', + '8H AH 6H 7D 7S QD 3C 4C 6C KC', + '3H 2C QH 8H AS 7D 4C 8C 4H KC', + 'QD 5S 4H 2C TD AH JH QH 4C 8S', + '3H QS 5S JS 8H 2S 9H 9C 3S 2C', + '6H TS 7S JC QD AC TD KC 5S 3H', + 'QH AS QS 7D JC KC 2C 4C 5C 5S', + 'QH 3D AS JS 4H 8D 7H JC 2S 9C', + '5D 4D 2S 4S 9D 9C 2D QS 8H 7H', + '6D 7H 3H JS TS AC 2D JH 7C 8S', + 'JH 5H KC 3C TC 5S 9H 4C 8H 9D', + '8S KC 5H 9H AD KS 9D KH 8D AH', + 'JC 2H 9H KS 6S 3H QC 5H AH 9C', + '5C KH 5S AD 6C JC 9H QC 9C TD', + '5S 5D JC QH 2D KS 8H QS 2H TS', + 'JH 5H 5S AH 7H 3C 8S AS TD KH', + '6H 3D JD 2C 4C KC 7S AH 6C JH', + '4C KS 9D AD 7S KC 7D 8H 3S 9C', + '7H 5C 5H 3C 8H QC 3D KH 6D JC', + '2D 4H 5D 7D QC AD AH 9H QH 8H', + 'KD 8C JS 9D 3S 3C 2H 5D 6D 2S', + '8S 6S TS 3C 6H 8D 5S 3H TD 6C', + 'KS 3D JH 9C 7C 9S QS 5S 4H 6H', + '7S 6S TH 4S KC KD 3S JC JH KS', + '7C 3C 2S 6D QH 2C 7S 5H 8H AH', + 'KC 8D QD 6D KH 5C 7H 9D 3D 9C', + '6H 2D 8S JS 9S 2S 6D KC 7C TC', + 'KD 9C JH 7H KC 8S 2S 7S 3D 6H', + '4H 9H 2D 4C 8H 7H 5S 8S 2H 8D', + 'AD 7C 3C 7S 5S 4D 9H 3D JC KH', + '5D AS 7D 6D 9C JC 4C QH QS KH', + 'KD JD 7D 3D QS QC 8S 6D JS QD', + '6S 8C 5S QH TH 9H AS AC 2C JD', + 'QC KS QH 7S 3C 4C 5C KC 5D AH', + '6C 4H 9D AH 2C 3H KD 3D TS 5C', + 'TD 8S QS AS JS 3H KD AC 4H KS', + '7D 5D TS 9H 4H 4C 9C 2H 8C QC', + '2C 7D 9H 4D KS 4C QH AD KD JS', + 'QD AD AH KH 9D JS 9H JC KD JD', + '8S 3C 4S TS 7S 4D 5C 2S 6H 7C', + 'JS 7S 5C KD 6D QH 8S TD 2H 6S', + 'QH 6C TC 6H TD 4C 9D 2H QC 8H', + '3D TS 4D 2H 6H 6S 2C 7H 8S 6C', + '9H 9D JD JH 3S AH 2C 6S 3H 8S', + '2C QS 8C 5S 3H 2S 7D 3C AD 4S', + '5C QC QH AS TS 4S 6S 4C 5H JS', + 'JH 5C TD 4C 6H JS KD KH QS 4H', + 'TC KH JC 4D 9H 9D 8D KC 3C 8H', + '2H TC 8S AD 9S 4H TS 7H 2C 5C', + '4H 2S 6C 5S KS AH 9C 7C 8H KD', + 'TS QH TD QS 3C JH AH 2C 8D 7D', + '5D KC 3H 5S AC 4S 7H QS 4C 2H', + '3D 7D QC KH JH 6D 6C TD TH KD', + '5S 8D TH 6C 9D 7D KH 8C 9S 6D', + 'JD QS 7S QC 2S QH JC 4S KS 8D', + '7S 5S 9S JD KD 9C JC AD 2D 7C', + '4S 5H AH JH 9C 5D TD 7C 2D 6S', + 'KC 6C 7H 6S 9C QD 5S 4H KS TD', + '6S 8D KS 2D TH TD 9H JD TS 3S', + 'KH JS 4H 5D 9D TC TD QC JD TS', + 'QS QD AC AD 4C 6S 2D AS 3H KC', + '4C 7C 3C TD QS 9C KC AS 8D AD', + 'KC 7H QC 6D 8H 6S 5S AH 7S 8C', + '3S AD 9H JC 6D JD AS KH 6S JH', + 'AD 3D TS KS 7H JH 2D JS QD AC', + '9C JD 7C 6D TC 6H 6C JC 3D 3S', + 'QC KC 3S JC KD 2C 8D AH QS TS', + 'AS KD 3D JD 8H 7C 8C 5C QD 6C' +]; +``` + +
+ + + + ## Solution
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-55-lychrel-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-55-lychrel-numbers.english.md index 917f85ab04..80959f7ae8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-55-lychrel-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-55-lychrel-numbers.english.md @@ -7,16 +7,27 @@ forumTopicId: 302166 ## 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 + +
+ 349 + 943 = 1292,
+ 1292 + 2921 = 4213
+ 4213 + 3124 = 7337
+
+ 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 num? -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. +
## Instructions @@ -29,16 +40,18 @@ NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretica ```yml tests: + - text: countLychrelNumbers(1000) should return a number. + testString: assert(typeof countLychrelNumbers(1000) === 'number'); - text: countLychrelNumbers(1000) should return 13. testString: assert.strictEqual(countLychrelNumbers(1000), 13); + - text: countLychrelNumbers(3243) should return 39. + testString: assert.strictEqual(countLychrelNumbers(3243), 39); - text: countLychrelNumbers(5000) should return 76. testString: assert.strictEqual(countLychrelNumbers(5000), 76); + - text: countLychrelNumbers(7654) should return 140. + testString: assert.strictEqual(countLychrelNumbers(7654), 140); - text: countLychrelNumbers(10000) 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); ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-56-powerful-digit-sum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-56-powerful-digit-sum.english.md index cce23c522a..efd726a93b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-56-powerful-digit-sum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-56-powerful-digit-sum.english.md @@ -7,8 +7,11 @@ forumTopicId: 302167 ## 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 (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? +
## Instructions @@ -21,8 +24,10 @@ Considering natural numbers of the form, ab, where a, b < 100, what is the maxim ```yml tests: - - text: euler56() should return 972. - testString: assert.strictEqual(euler56(), 972); + - text: powerfulDigitSum() should return a number. + testString: assert(typeof powerfulDigitSum() === 'number'); + - text: powerfulDigitSum() should return 972. + testString: assert.strictEqual(powerfulDigitSum(), 972); ``` @@ -34,12 +39,12 @@ tests:
```js -function euler56() { +function powerfulDigitSum() { // Good luck! return true; } -euler56(); +powerfulDigitSum(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-57-square-root-convergents.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-57-square-root-convergents.english.md index 13394ebe90..71c218d7c7 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-57-square-root-convergents.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-57-square-root-convergents.english.md @@ -7,15 +7,25 @@ forumTopicId: 302168 ## 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... + +
$\sqrt 2 =1+ \frac 1 {2+ \frac 1 {2 +\frac 1 {2+ \dots}}}$
+ 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? +
## Instructions @@ -28,8 +38,10 @@ In the first one-thousand expansions, how many fractions contain a numerator wit ```yml tests: - - text: euler57() should return 153. - testString: assert.strictEqual(euler57(), 153); + - text: squareRootConvergents() should return a number. + testString: assert(typeof squareRootConvergents() === 'number'); + - text: squareRootConvergents() should return 153. + testString: assert.strictEqual(squareRootConvergents(), 153); ``` @@ -41,12 +53,12 @@ tests:
```js -function euler57() { +function squareRootConvergents() { // Good luck! return true; } -euler57(); +squareRootConvergents(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-58-spiral-primes.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-58-spiral-primes.english.md index 0aa69fdc09..27ea3247e5 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-58-spiral-primes.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-58-spiral-primes.english.md @@ -7,15 +7,23 @@ forumTopicId: 302169 ## 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 + +
+ 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 26
+ 43 44 45 46 47 48 49
+
+ 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%? +
## Instructions @@ -28,8 +36,10 @@ If one complete new layer is wrapped around the spiral above, a square spiral wi ```yml tests: - - text: euler58() should return 26241. - testString: assert.strictEqual(euler58(), 26241); + - text: spiralPrimes() should return a number. + testString: assert(typeof spiralPrimes() === 'number'); + - text: spiralPrimes() should return 26241. + testString: assert.strictEqual(spiralPrimes(), 26241); ``` @@ -41,12 +51,12 @@ tests:
```js -function euler58() { +function spiralPrimes() { // Good luck! return true; } -euler58(); +spiralPrimes(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-59-xor-decryption.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-59-xor-decryption.english.md index 17331f90ab..84e2ea321f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-59-xor-decryption.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-59-xor-decryption.english.md @@ -7,11 +7,17 @@ forumTopicId: 302170 ## 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. +
## Instructions @@ -24,8 +30,10 @@ Your task has been made easy, as the encryption key consists of three lower case ```yml tests: - - text: euler59() should return 107359. - testString: assert.strictEqual(euler59(), 107359); + - text: XORDecryption(cipher) should return a number. + testString: assert(typeof XORDecryption(cipher) === 'number'); + - text: XORDecryption(cipher) should return 107359. + testString: assert.strictEqual(XORDecryption(cipher), 107359); ``` @@ -37,12 +45,18 @@ tests:
```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); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-6-sum-square-difference.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-6-sum-square-difference.english.md index d19f2910b4..a0beae6a33 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-6-sum-square-difference.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-6-sum-square-difference.english.md @@ -7,12 +7,19 @@ forumTopicId: 302171 ## Description
+ The sum of the squares of the first ten natural numbers is, +
12 + 22 + ... + 102 = 385
+ The square of the sum of the first ten natural numbers is, +
(1 + 2 + ... + 10)2 = 552 = 3025
+ 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 n 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. +
## Instructions @@ -25,6 +32,8 @@ Find the difference between the sum of the squares of the first n n ```yml tests: + - text: sumSquareDifference(10) should return a number. + testString: assert(typeof sumSquareDifference(10) === 'number'); - text: sumSquareDifference(10) should return 2640. testString: assert.strictEqual(sumSquareDifference(10), 2640); - text: sumSquareDifference(20) should return 41230. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-60-prime-pair-sets.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-60-prime-pair-sets.english.md index c08bf5a503..16864a0b87 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-60-prime-pair-sets.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-60-prime-pair-sets.english.md @@ -7,8 +7,11 @@ forumTopicId: 302172 ## 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. +
## Instructions @@ -21,8 +24,10 @@ Find the lowest sum for a set of five primes for which any two primes concatenat ```yml tests: - - text: euler60() should return 26033. - testString: assert.strictEqual(euler60(), 26033); + - text: primePairSets() should return a number. + testString: assert(typeof primePairSets() === 'number'); + - text: primePairSets() should return 26033. + testString: assert.strictEqual(primePairSets(), 26033); ``` @@ -34,12 +39,12 @@ tests:
```js -function euler60() { +function primePairSets() { // Good luck! return true; } -euler60(); +primePairSets(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.english.md index 600f1b4cfa..9eb664bb84 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-61-cyclical-figurate-numbers.english.md @@ -19,10 +19,15 @@ Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are a |Octagonal|P8,n=n(3n−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. + +
    +
  1. 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).
  2. +
  3. 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.
  4. +
  5. This is the only set of 4-digit numbers with this property.
  6. +
+ 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. +
## 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: euler61() should return 28684. - testString: assert.strictEqual(euler61(), 28684); + - text: cyclicalFigurateNums() should return a number. + testString: assert(typeof cyclicalFigurateNums() === 'number'); + - text: cyclicalFigurateNums() should return 28684. + testString: assert.strictEqual(cyclicalFigurateNums(), 28684); ``` @@ -48,12 +55,12 @@ tests:
```js -function euler61() { +function cyclicalFigurateNums() { // Good luck! return true; } -euler61(); +cyclicalFigurateNums(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-62-cubic-permutations.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-62-cubic-permutations.english.md index e42497783a..4283eb90a9 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-62-cubic-permutations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-62-cubic-permutations.english.md @@ -7,8 +7,11 @@ forumTopicId: 302174 ## 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 (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. + Find the smallest cube for which exactly five permutations of its digits are cube. +
## Instructions @@ -21,8 +24,10 @@ Find the smallest cube for which exactly five permutations of its digits are cub ```yml tests: - - text: euler62() should return 127035954683. - testString: assert.strictEqual(euler62(), 127035954683); + - text: cubicPermutations() should return a number. + testString: assert(typeof cubicPermutations() === 'number'); + - text: cubicPermutations() should return 127035954683. + testString: assert.strictEqual(cubicPermutations(), 127035954683); ``` @@ -34,12 +39,12 @@ tests:
```js -function euler62() { +function cubicPermutations() { // Good luck! return true; } -euler62(); +cubicPermutations(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-63-powerful-digit-counts.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-63-powerful-digit-counts.english.md index f7e8bbcdeb..de156ee3ef 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-63-powerful-digit-counts.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-63-powerful-digit-counts.english.md @@ -7,8 +7,11 @@ forumTopicId: 302175 ## 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 = 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? +
## Instructions @@ -21,8 +24,10 @@ How many n-digit positive integers exist which are also an nth power? ```yml tests: - - text: euler63() should return 49. - testString: assert.strictEqual(euler63(), 49); + - text: powerfulDigitCounts() should return a number. + testString: assert(typeof powerfulDigitCounts() === 'number'); + - text: powerfulDigitCounts() should return 49. + testString: assert.strictEqual(powerfulDigitCounts(), 49); ``` @@ -34,12 +39,12 @@ tests:
```js -function euler63() { +function powerfulDigitCounts() { // Good luck! return true; } -euler63(); +powerfulDigitCounts(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-64-odd-period-square-roots.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-64-odd-period-square-roots.english.md index 8244661fdb..92673bfa9c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-64-odd-period-square-roots.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-64-odd-period-square-roots.english.md @@ -7,130 +7,65 @@ forumTopicId: 302176 ## 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? +
## Instructions @@ -143,8 +78,10 @@ How many continued fractions for N ≤ 10000 have an odd period? ```yml tests: - - text: euler64() should return 1322. - testString: assert.strictEqual(euler64(), 1322); + - text: oddPeriodSqrts() should return a number. + testString: assert(typeof oddPeriodSqrts() === 'number'); + - text: oddPeriodSqrts() should return 1322. + testString: assert.strictEqual(oddPeriodSqrts(), 1322); ``` @@ -156,12 +93,12 @@ tests:
```js -function euler64() { +function oddPeriodSqrts() { // Good luck! return true; } -euler64(); +oddPeriodSqrts(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-65-convergents-of-e.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-65-convergents-of-e.english.md index f8945347f7..b4a8e3d901 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-65-convergents-of-e.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-65-convergents-of-e.english.md @@ -7,96 +7,32 @@ forumTopicId: 302177 ## 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 ad infinitum. 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 e 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 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. - -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.
## Instructions @@ -109,8 +45,10 @@ Find the sum of digits in the numerator of the 100th convergent of the continued ```yml tests: - - text: euler65() should return 272. - testString: assert.strictEqual(euler65(), 272); + - text: convergentsOfE() should return a number. + testString: assert(typeof convergentsOfE() === 'number'); + - text: convergentsOfE() should return 272. + testString: assert.strictEqual(convergentsOfE(), 272); ``` @@ -122,12 +60,12 @@ tests:
```js -function euler65() { +function convergentsOfE() { // Good luck! return true; } -euler65(); +convergentsOfE(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-66-diophantine-equation.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-66-diophantine-equation.english.md index 61bf2ea825..23f26624b6 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-66-diophantine-equation.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-66-diophantine-equation.english.md @@ -7,17 +7,29 @@ forumTopicId: 302178 ## 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. + +
x2 – Dy2 = 1
+ +For example, when D=13, the minimal solution in x is 6492 – 13×1802 = 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. + +
+ 32 – 2×22 = 1
+ 22 – 3×12 = 1
+ 92 – 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. +
## Instructions @@ -30,8 +42,10 @@ Find the value of D ≤ 1000 in minimal solutions of x for which the largest val ```yml tests: - - text: euler66() should return 661. - testString: assert.strictEqual(euler66(), 661); + - text: diophantineEquation() should return a number. + testString: assert(typeof diophantineEquation() === 'number'); + - text: diophantineEquation() should return 661. + testString: assert.strictEqual(diophantineEquation(), 661); ``` @@ -43,12 +57,12 @@ tests:
```js -function euler66() { +function diophantineEquation() { // Good luck! return true; } -euler66(); +diophantineEquation(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-67-maximum-path-sum-ii.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-67-maximum-path-sum-ii.english.md index d402a72694..cdfdc39d7d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-67-maximum-path-sum-ii.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-67-maximum-path-sum-ii.english.md @@ -7,13 +7,22 @@ forumTopicId: 302179 ## 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. -37 4 -2 4 6 -8 5 9 3 + +
+ 3
+ 7 4
+ 2 4 6
+ 8 5 9 3 +
+ That is, 3 + 7 + 4 + 9 = 23. -Find the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containing a triangle with one-hundred rows. -NOTE: This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o) + +Find the maximum total from top to bottom in `numTriangle`, a 2D array defined in the background containing a triangle with one-hundred rows. + +**Note:** This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o) +
## Instructions @@ -26,8 +35,12 @@ NOTE: This is a much more difficult version of Problem 18. It is not possible to ```yml tests: - - text: euler67() should return 7273. - testString: assert.strictEqual(euler67(), 7273); + - text: maximumPathSumII(testTriangle) should return a number. + testString: assert(typeof maximumPathSumII(testTriangle) === 'number'); + - text: maximumPathSumII(testTriangle) should return 23. + testString: assert.strictEqual(maximumPathSumII(testTriangle), 23); + - text: maximumPathSumII(numTriangle) should return 7273. + testString: assert.strictEqual(maximumPathSumII(numTriangle), 7273); ``` @@ -39,12 +52,28 @@ tests:
```js -function euler67() { +function maximumPathSumII(triangle) { // Good luck! return true; } -euler67(); +const testTriangle = [[3, 0, 0, 0], + [7, 4, 0, 0], + [2, 4, 6, 0], + [8, 5, 9, 3]]; + +maximumPathSumII(testTriangle); +``` + +
+ + + +### Before Test +
+ +```js +const numTriangle = [[59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[73,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[52,40,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[26,53,6,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[10,51,87,86,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[61,95,66,57,25,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[90,81,80,38,92,67,73,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[30,28,51,76,81,18,75,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[84,14,95,87,62,81,17,78,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[21,46,71,58,2,79,62,39,31,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[56,34,35,53,78,31,81,18,90,93,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[78,53,4,21,84,93,32,13,97,11,37,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[45,3,81,79,5,18,78,86,13,30,63,99,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[39,87,96,28,3,38,42,17,82,87,58,7,22,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[6,17,51,17,7,93,9,7,75,97,95,78,87,8,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[67,66,59,60,88,99,94,65,55,77,55,34,27,53,78,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[76,40,41,4,87,16,9,42,75,69,23,97,30,60,10,79,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[12,10,44,26,21,36,32,84,98,60,13,12,36,16,63,31,91,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[70,39,6,5,55,27,38,48,28,22,34,35,62,62,15,14,94,89,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[66,56,68,84,96,21,34,34,34,81,62,40,65,54,62,5,98,3,2,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[38,89,46,37,99,54,34,53,36,14,70,26,2,90,45,13,31,61,83,73,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[36,10,63,96,60,49,41,5,37,42,14,58,84,93,96,17,9,43,5,43,6,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[66,57,87,57,61,28,37,51,84,73,79,15,39,95,88,87,43,39,11,86,77,74,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[54,42,5,79,30,49,99,73,46,37,50,2,45,9,54,52,27,95,27,65,19,45,26,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[71,39,17,78,76,29,52,90,18,99,78,19,35,62,71,19,23,65,93,85,49,33,75,9,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[33,24,47,61,60,55,32,88,57,55,91,54,46,57,7,77,98,52,80,99,24,25,46,78,79,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[92,9,13,55,10,67,26,78,76,82,63,49,51,31,24,68,5,57,7,54,69,21,67,43,17,63,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[24,59,6,8,98,74,66,26,61,60,13,3,9,9,24,30,71,8,88,70,72,70,29,90,11,82,41,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[66,82,67,4,36,60,92,77,91,85,62,49,59,61,30,90,29,94,26,41,89,4,53,22,83,41,9,74,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[48,28,26,37,28,52,77,26,51,32,18,98,79,36,62,13,17,8,19,54,89,29,73,68,42,14,8,16,70,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[37,60,69,70,72,71,9,59,13,60,38,13,57,36,9,30,43,89,30,39,15,2,44,73,5,73,26,63,56,86,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[55,55,85,50,62,99,84,77,28,85,3,21,27,22,19,26,82,69,54,4,13,7,85,14,1,15,70,59,89,95,10,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[4,9,31,92,91,38,92,86,98,75,21,5,64,42,62,84,36,20,73,42,21,23,22,51,51,79,25,45,85,53,3,43,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[75,63,2,49,14,12,89,14,60,78,92,16,44,82,38,30,72,11,46,52,90,27,8,65,78,3,85,41,57,79,39,52,33,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[78,27,56,56,39,13,19,43,86,72,58,95,39,7,4,34,21,98,39,15,39,84,89,69,84,46,37,57,59,35,59,50,26,15,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[42,89,36,27,78,91,24,11,17,41,5,94,7,69,51,96,3,96,47,90,90,45,91,20,50,56,10,32,36,49,4,53,85,92,25,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[52,9,61,30,61,97,66,21,96,92,98,90,6,34,96,60,32,69,68,33,75,84,18,31,71,50,84,63,3,3,19,11,28,42,75,45,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[61,31,61,68,96,34,49,39,5,71,76,59,62,67,6,47,96,99,34,21,32,47,52,7,71,60,42,72,94,56,82,83,84,40,94,87,82,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,20,60,14,17,38,26,78,66,81,45,95,18,51,98,81,48,16,53,88,37,52,69,95,72,93,22,34,98,20,54,27,73,61,56,63,60,34,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[93,42,94,83,47,61,27,51,79,79,45,1,44,73,31,70,83,42,88,25,53,51,30,15,65,94,80,44,61,84,12,77,2,62,2,65,94,42,14,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[32,73,9,67,68,29,74,98,10,19,85,48,38,31,85,67,53,93,93,77,47,67,39,72,94,53,18,43,77,40,78,32,29,59,24,6,2,83,50,60,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[32,1,44,30,16,51,15,81,98,15,10,62,86,79,50,62,45,60,70,38,31,85,65,61,64,6,69,84,14,22,56,43,9,48,66,69,83,91,60,40,36,61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[92,48,22,99,15,95,64,43,1,16,94,2,99,19,17,69,11,58,97,56,89,31,77,45,67,96,12,73,8,20,36,47,81,44,50,64,68,85,40,81,85,52,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[91,35,92,45,32,84,62,15,19,64,21,66,6,1,52,80,62,59,12,25,88,28,91,50,40,16,22,99,92,79,87,51,21,77,74,77,7,42,38,42,74,83,2,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[46,19,77,66,24,18,5,32,2,84,31,99,92,58,96,72,91,36,62,99,55,29,53,42,12,37,26,58,89,50,66,19,82,75,12,48,24,87,91,85,2,7,3,76,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[99,98,84,93,7,17,33,61,92,20,66,60,24,66,40,30,67,5,37,29,24,96,3,27,70,62,13,4,45,47,59,88,43,20,66,15,46,92,30,4,71,66,78,70,53,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[67,60,38,6,88,4,17,72,10,99,71,7,42,25,54,5,26,64,91,50,45,71,6,30,67,48,69,82,8,56,80,67,18,46,66,63,1,20,8,80,47,7,91,16,3,79,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[18,54,78,49,80,48,77,40,68,23,60,88,58,80,33,57,11,69,55,53,64,2,94,49,60,92,16,35,81,21,82,96,25,24,96,18,2,5,49,3,50,77,6,32,84,27,18,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[68,1,50,4,3,21,42,94,53,24,89,5,92,26,52,36,68,11,85,1,4,42,2,45,15,6,50,4,53,73,25,74,81,88,98,21,67,84,79,97,99,20,95,4,40,46,2,58,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[94,10,2,78,88,52,21,3,88,60,6,53,49,71,20,91,12,65,7,49,21,22,11,41,58,99,36,16,9,48,17,24,52,36,23,15,72,16,84,56,2,99,43,76,81,71,29,39,49,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[64,39,59,84,86,16,17,66,3,9,43,6,64,18,63,29,68,6,23,7,87,14,26,35,17,12,98,41,53,64,78,18,98,27,28,84,80,67,75,62,10,11,76,90,54,10,5,54,41,39,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[43,83,18,37,32,31,52,29,95,47,8,76,35,11,4,53,35,43,34,10,52,57,12,36,20,39,40,55,78,44,7,31,38,26,8,15,56,88,86,1,52,62,10,24,32,5,60,65,53,28,57,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[3,50,3,52,7,73,49,92,66,80,1,46,8,67,25,36,73,93,7,42,25,53,13,96,76,83,87,90,54,89,78,22,78,91,73,51,69,9,79,94,83,53,9,40,69,62,10,79,49,47,3,81,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[71,54,73,33,51,76,59,54,79,37,56,45,84,17,62,21,98,69,41,95,65,24,39,37,62,3,24,48,54,64,46,82,71,78,33,67,9,16,96,68,52,74,79,68,32,21,13,78,96,60,9,69,20,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[73,26,21,44,46,38,17,83,65,98,7,23,52,46,61,97,33,13,60,31,70,15,36,77,31,58,56,93,75,68,21,36,69,53,90,75,25,82,39,50,65,94,29,30,11,33,11,13,96,2,56,47,7,49,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[76,46,73,30,10,20,60,70,14,56,34,26,37,39,48,24,55,76,84,91,39,86,95,61,50,14,53,93,64,67,37,31,10,84,42,70,48,20,10,72,60,61,84,79,69,65,99,73,89,25,85,48,92,56,97,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[3,14,80,27,22,30,44,27,67,75,79,32,51,54,81,29,65,14,19,4,13,82,4,91,43,40,12,52,29,99,7,76,60,25,1,7,61,71,37,92,40,47,99,66,57,1,43,44,22,40,53,53,9,69,26,81,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[49,80,56,90,93,87,47,13,75,28,87,23,72,79,32,18,27,20,28,10,37,59,21,18,70,4,79,96,3,31,45,71,81,6,14,18,17,5,31,50,92,79,23,47,9,39,47,91,43,54,69,47,42,95,62,46,32,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[37,18,62,85,87,28,64,5,77,51,47,26,30,65,5,70,65,75,59,80,42,52,25,20,44,10,92,17,71,95,52,14,77,13,24,55,11,65,26,91,1,30,63,15,49,48,41,17,67,47,3,68,20,90,98,32,4,40,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[90,51,58,60,6,55,23,68,5,19,76,94,82,36,96,43,38,90,87,28,33,83,5,17,70,83,96,93,6,4,78,47,80,6,23,84,75,23,87,72,99,14,50,98,92,38,90,64,61,58,76,94,36,66,87,80,51,35,61,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[57,95,64,6,53,36,82,51,40,33,47,14,7,98,78,65,39,58,53,6,50,53,4,69,40,68,36,69,75,78,75,60,3,32,39,24,74,47,26,90,13,40,44,71,90,76,51,24,36,50,25,45,70,80,61,80,61,43,90,64,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[18,29,86,56,68,42,79,10,42,44,30,12,96,18,23,18,52,59,2,99,67,46,60,86,43,38,55,17,44,93,42,21,55,14,47,34,55,16,49,24,23,29,96,51,55,10,46,53,27,92,27,46,63,57,30,65,43,27,21,20,24,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[81,72,93,19,69,52,48,1,13,83,92,69,20,48,69,59,20,62,5,42,28,89,90,99,32,72,84,17,8,87,36,3,60,31,36,36,81,26,97,36,48,54,56,56,27,16,91,8,23,11,87,99,33,47,2,14,44,73,70,99,43,35,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[90,56,61,86,56,12,70,59,63,32,1,15,81,47,71,76,95,32,65,80,54,70,34,51,40,45,33,4,64,55,78,68,88,47,31,47,68,87,3,84,23,44,89,72,35,8,31,76,63,26,90,85,96,67,65,91,19,14,17,86,4,71,32,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[37,13,4,22,64,37,37,28,56,62,86,33,7,37,10,44,52,82,52,6,19,52,57,75,90,26,91,24,6,21,14,67,76,30,46,14,35,89,89,41,3,64,56,97,87,63,22,34,3,79,17,45,11,53,25,56,96,61,23,18,63,31,37,37,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[77,23,26,70,72,76,77,4,28,64,71,69,14,85,96,54,95,48,6,62,99,83,86,77,97,75,71,66,30,19,57,90,33,1,60,61,14,12,90,99,32,77,56,41,18,14,87,49,10,14,90,64,18,50,21,74,14,16,88,5,45,73,82,47,74,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[22,97,41,13,34,31,54,61,56,94,3,24,59,27,98,77,4,9,37,40,12,26,87,9,71,70,7,18,64,57,80,21,12,71,83,94,60,39,73,79,73,19,97,32,64,29,41,7,48,84,85,67,12,74,95,20,24,52,41,67,56,61,29,93,35,72,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[72,23,63,66,1,11,7,30,52,56,95,16,65,26,83,90,50,74,60,18,16,48,43,77,37,11,99,98,30,94,91,26,62,73,45,12,87,73,47,27,1,88,66,99,21,41,95,80,2,53,23,32,61,48,32,43,43,83,14,66,95,91,19,81,80,67,25,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[8,62,32,18,92,14,83,71,37,96,11,83,39,99,5,16,23,27,10,67,2,25,44,11,55,31,46,64,41,56,44,74,26,81,51,31,45,85,87,9,81,95,22,28,76,69,46,48,64,87,67,76,27,89,31,11,74,16,62,3,60,94,42,47,9,34,94,93,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[56,18,90,18,42,17,42,32,14,86,6,53,33,95,99,35,29,15,44,20,49,59,25,54,34,59,84,21,23,54,35,90,78,16,93,13,37,88,54,19,86,67,68,55,66,84,65,42,98,37,87,56,33,28,58,38,28,38,66,27,52,21,81,15,8,22,97,32,85,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[91,53,40,28,13,34,91,25,1,63,50,37,22,49,71,58,32,28,30,18,68,94,23,83,63,62,94,76,80,41,90,22,82,52,29,12,18,56,10,8,35,14,37,57,23,65,67,40,72,39,93,39,70,89,40,34,7,46,94,22,20,5,53,64,56,30,5,56,61,88,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[23,95,11,12,37,69,68,24,66,10,87,70,43,50,75,7,62,41,83,58,95,93,89,79,45,39,2,22,5,22,95,43,62,11,68,29,17,40,26,44,25,71,87,16,70,85,19,25,59,94,90,41,41,80,61,70,55,60,84,33,95,76,42,63,15,9,3,40,38,12,3,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[9,84,56,80,61,55,85,97,16,94,82,94,98,57,84,30,84,48,93,90,71,5,95,90,73,17,30,98,40,64,65,89,7,79,9,19,56,36,42,30,23,69,73,72,7,5,27,61,24,31,43,48,71,84,21,28,26,65,65,59,65,74,77,20,10,81,61,84,95,8,52,23,70,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[47,81,28,9,98,51,67,64,35,51,59,36,92,82,77,65,80,24,72,53,22,7,27,10,21,28,30,22,48,82,80,48,56,20,14,43,18,25,50,95,90,31,77,8,9,48,44,80,90,22,93,45,82,17,13,96,25,26,8,73,34,99,6,49,24,6,83,51,40,14,15,10,25,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[54,25,10,81,30,64,24,74,75,80,36,75,82,60,22,69,72,91,45,67,3,62,79,54,89,74,44,83,64,96,66,73,44,30,74,50,37,5,9,97,70,1,60,46,37,91,39,75,75,18,58,52,72,78,51,81,86,52,8,97,1,46,43,66,98,62,81,18,70,93,73,8,32,46,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[96,80,82,7,59,71,92,53,19,20,88,66,3,26,26,10,24,27,50,82,94,73,63,8,51,33,22,45,19,13,58,33,90,15,22,50,36,13,55,6,35,47,82,52,33,61,36,27,28,46,98,14,73,20,73,32,16,26,80,53,47,66,76,38,94,45,2,1,22,52,47,96,64,58,52,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[88,46,23,39,74,63,81,64,20,90,33,33,76,55,58,26,10,46,42,26,74,74,12,83,32,43,9,2,73,55,86,54,85,34,28,23,29,79,91,62,47,41,82,87,99,22,48,90,20,5,96,75,95,4,43,28,81,39,81,1,28,42,78,25,39,77,90,57,58,98,17,36,73,22,63,74,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[29,39,74,94,95,78,64,24,38,86,63,87,93,6,70,92,22,16,80,64,29,52,20,27,23,50,14,13,87,15,72,96,81,22,8,49,72,30,70,24,79,31,16,64,59,21,89,34,96,91,48,76,43,53,88,1,57,80,23,81,90,79,58,1,80,87,17,99,86,90,72,63,32,69,14,28,88,69,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[37,17,71,95,56,93,71,35,43,45,4,98,92,94,84,96,11,30,31,27,31,60,92,3,48,5,98,91,86,94,35,90,90,8,48,19,33,28,68,37,59,26,65,96,50,68,22,7,9,49,34,31,77,49,43,6,75,17,81,87,61,79,52,26,27,72,29,50,7,98,86,1,17,10,46,64,24,18,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[51,30,25,94,88,85,79,91,40,33,63,84,49,67,98,92,15,26,75,19,82,5,18,78,65,93,61,48,91,43,59,41,70,51,22,15,92,81,67,91,46,98,11,11,65,31,66,10,98,65,83,21,5,56,5,98,73,67,46,74,69,34,8,30,5,52,7,98,32,95,30,94,65,50,24,63,28,81,99,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[19,23,61,36,9,89,71,98,65,17,30,29,89,26,79,74,94,11,44,48,97,54,81,55,39,66,69,45,28,47,13,86,15,76,74,70,84,32,36,33,79,20,78,14,41,47,89,28,81,5,99,66,81,86,38,26,6,25,13,60,54,55,23,53,27,5,89,25,23,11,13,54,59,54,56,34,16,24,53,44,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[13,40,57,72,21,15,60,8,4,19,11,98,34,45,9,97,86,71,3,15,56,19,15,44,97,31,90,4,87,87,76,8,12,30,24,62,84,28,12,85,82,53,99,52,13,94,6,65,97,86,9,50,94,68,69,74,30,67,87,94,63,7,78,27,80,36,69,41,6,92,32,78,37,82,30,5,18,87,99,72,19,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[44,20,55,77,69,91,27,31,28,81,80,27,2,7,97,23,95,98,12,25,75,29,47,71,7,47,78,39,41,59,27,76,13,15,66,61,68,35,69,86,16,53,67,63,99,85,41,56,8,28,33,40,94,76,90,85,31,70,24,65,84,65,99,82,19,25,54,37,21,46,33,2,52,99,51,33,26,4,87,2,8,18,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[54,42,61,45,91,6,64,79,80,82,32,16,83,63,42,49,19,78,65,97,40,42,14,61,49,34,4,18,25,98,59,30,82,72,26,88,54,36,21,75,3,88,99,53,46,51,55,78,22,94,34,40,68,87,84,25,30,76,25,8,92,84,42,61,40,38,9,99,40,23,29,39,46,55,10,90,35,84,56,70,63,23,91,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[52,92,3,71,89,7,9,37,68,66,58,20,44,92,51,56,13,71,79,99,26,37,2,6,16,67,36,52,58,16,79,73,56,60,59,27,44,77,94,82,20,50,98,33,9,87,94,37,40,83,64,83,58,85,17,76,53,2,83,52,22,27,39,20,48,92,45,21,9,42,24,23,12,37,52,28,50,78,79,20,86,62,73,20,59,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[54,96,80,15,91,90,99,70,10,9,58,90,93,50,81,99,54,38,36,10,30,11,35,84,16,45,82,18,11,97,36,43,96,79,97,65,40,48,23,19,17,31,64,52,65,65,37,32,65,76,99,79,34,65,79,27,55,33,3,1,33,27,61,28,66,8,4,70,49,46,48,83,1,45,19,96,13,81,14,21,31,79,93,85,50,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[92,92,48,84,59,98,31,53,23,27,15,22,79,95,24,76,5,79,16,93,97,89,38,89,42,83,2,88,94,95,82,21,1,97,48,39,31,78,9,65,50,56,97,61,1,7,65,27,21,23,14,15,80,97,44,78,49,35,33,45,81,74,34,5,31,57,9,38,94,7,69,54,69,32,65,68,46,68,78,90,24,28,49,51,45,86,35,0,0,0,0,0,0,0,0,0,0,0,0,0],[41,63,89,76,87,31,86,9,46,14,87,82,22,29,47,16,13,10,70,72,82,95,48,64,58,43,13,75,42,69,21,12,67,13,64,85,58,23,98,9,37,76,5,22,31,12,66,50,29,99,86,72,45,25,10,28,19,6,90,43,29,31,67,79,46,25,74,14,97,35,76,37,65,46,23,82,6,22,30,76,93,66,94,17,96,13,20,72,0,0,0,0,0,0,0,0,0,0,0,0],[63,40,78,8,52,9,90,41,70,28,36,14,46,44,85,96,24,52,58,15,87,37,5,98,99,39,13,61,76,38,44,99,83,74,90,22,53,80,56,98,30,51,63,39,44,30,91,91,4,22,27,73,17,35,53,18,35,45,54,56,27,78,48,13,69,36,44,38,71,25,30,56,15,22,73,43,32,69,59,25,93,83,45,11,34,94,44,39,92,0,0,0,0,0,0,0,0,0,0,0],[12,36,56,88,13,96,16,12,55,54,11,47,19,78,17,17,68,81,77,51,42,55,99,85,66,27,81,79,93,42,65,61,69,74,14,1,18,56,12,1,58,37,91,22,42,66,83,25,19,4,96,41,25,45,18,69,96,88,36,93,10,12,98,32,44,83,83,4,72,91,4,27,73,7,34,37,71,60,59,31,1,54,54,44,96,93,83,36,4,45,0,0,0,0,0,0,0,0,0,0],[30,18,22,20,42,96,65,79,17,41,55,69,94,81,29,80,91,31,85,25,47,26,43,49,2,99,34,67,99,76,16,14,15,93,8,32,99,44,61,77,67,50,43,55,87,55,53,72,17,46,62,25,50,99,73,5,93,48,17,31,70,80,59,9,44,59,45,13,74,66,58,94,87,73,16,14,85,38,74,99,64,23,79,28,71,42,20,37,82,31,23,0,0,0,0,0,0,0,0,0],[51,96,39,65,46,71,56,13,29,68,53,86,45,33,51,49,12,91,21,21,76,85,2,17,98,15,46,12,60,21,88,30,92,83,44,59,42,50,27,88,46,86,94,73,45,54,23,24,14,10,94,21,20,34,23,51,4,83,99,75,90,63,60,16,22,33,83,70,11,32,10,50,29,30,83,46,11,5,31,17,86,42,49,1,44,63,28,60,7,78,95,40,0,0,0,0,0,0,0,0],[44,61,89,59,4,49,51,27,69,71,46,76,44,4,9,34,56,39,15,6,94,91,75,90,65,27,56,23,74,6,23,33,36,69,14,39,5,34,35,57,33,22,76,46,56,10,61,65,98,9,16,69,4,62,65,18,99,76,49,18,72,66,73,83,82,40,76,31,89,91,27,88,17,35,41,35,32,51,32,67,52,68,74,85,80,57,7,11,62,66,47,22,67,0,0,0,0,0,0,0],[65,37,19,97,26,17,16,24,24,17,50,37,64,82,24,36,32,11,68,34,69,31,32,89,79,93,96,68,49,90,14,23,4,4,67,99,81,74,70,74,36,96,68,9,64,39,88,35,54,89,96,58,66,27,88,97,32,14,6,35,78,20,71,6,85,66,57,2,58,91,72,5,29,56,73,48,86,52,9,93,22,57,79,42,12,1,31,68,17,59,63,76,7,77,0,0,0,0,0,0],[73,81,14,13,17,20,11,9,1,83,8,85,91,70,84,63,62,77,37,7,47,1,59,95,39,69,39,21,99,9,87,2,97,16,92,36,74,71,90,66,33,73,73,75,52,91,11,12,26,53,5,26,26,48,61,50,90,65,1,87,42,47,74,35,22,73,24,26,56,70,52,5,48,41,31,18,83,27,21,39,80,85,26,8,44,2,71,7,63,22,5,52,19,8,20,0,0,0,0,0],[17,25,21,11,72,93,33,49,64,23,53,82,3,13,91,65,85,2,40,5,42,31,77,42,5,36,6,54,4,58,7,76,87,83,25,57,66,12,74,33,85,37,74,32,20,69,3,97,91,68,82,44,19,14,89,28,85,85,80,53,34,87,58,98,88,78,48,65,98,40,11,57,10,67,70,81,60,79,74,72,97,59,79,47,30,20,54,80,89,91,14,5,33,36,79,39,0,0,0,0],[60,85,59,39,60,7,57,76,77,92,6,35,15,72,23,41,45,52,95,18,64,79,86,53,56,31,69,11,91,31,84,50,44,82,22,81,41,40,30,42,30,91,48,94,74,76,64,58,74,25,96,57,14,19,3,99,28,83,15,75,99,1,89,85,79,50,3,95,32,67,44,8,7,41,62,64,29,20,14,76,26,55,48,71,69,66,19,72,44,25,14,1,48,74,12,98,7,0,0,0],[64,66,84,24,18,16,27,48,20,14,47,69,30,86,48,40,23,16,61,21,51,50,26,47,35,33,91,28,78,64,43,68,4,79,51,8,19,60,52,95,6,68,46,86,35,97,27,58,4,65,30,58,99,12,12,75,91,39,50,31,42,64,70,4,46,7,98,73,98,93,37,89,77,91,64,71,64,65,66,21,78,62,81,74,42,20,83,70,73,95,78,45,92,27,34,53,71,15,0,0],[30,11,85,31,34,71,13,48,5,14,44,3,19,67,23,73,19,57,6,90,94,72,57,69,81,62,59,68,88,57,55,69,49,13,7,87,97,80,89,5,71,5,5,26,38,40,16,62,45,99,18,38,98,24,21,26,62,74,69,4,85,57,77,35,58,67,91,79,79,57,86,28,66,34,72,51,76,78,36,95,63,90,8,78,47,63,45,31,22,70,52,48,79,94,15,77,61,67,68,0],[23,33,44,81,80,92,93,75,94,88,23,61,39,76,22,3,28,94,32,6,49,65,41,34,18,23,8,47,62,60,3,63,33,13,80,52,31,54,73,43,70,26,16,69,57,87,83,31,3,93,70,81,47,95,77,44,29,68,39,51,56,59,63,7,25,70,7,77,43,53,64,3,94,42,95,39,18,1,66,21,16,97,20,50,90,16,70,10,95,69,29,6,25,61,41,26,15,59,63,35]]; ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.english.md index 2d533dbcd7..d4cc7afb83 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-68-magic-5-gon-ring.english.md @@ -7,10 +7,13 @@ forumTopicId: 302180 ## Description
+ Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine. +a completed example of a 3-gon ring + +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. -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.
@@ -29,7 +32,11 @@ It is possible to complete the ring with four different totals: 9, 10, 11, and 1
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 16-digit string for a "magic" 5-gon ring? + +a blank diagram of a 5-gon ring +
## Instructions @@ -42,8 +49,10 @@ Using the numbers 1 to 10, and depending on arrangements, it is possible to form ```yml tests: - - text: euler68() should return 6531031914842725. - testString: assert.strictEqual(euler68(), 6531031914842725); + - text: magic5GonRing() should return a number. + testString: assert(typeof magic5GonRing() === 'number'); + - text: magic5GonRing() should return 6531031914842725. + testString: assert.strictEqual(magic5GonRing(), 6531031914842725); ``` @@ -55,12 +64,12 @@ tests:
```js -function euler68() { +function magic5GonRing() { // Good luck! return true; } -euler68(); +magic5GonRing(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-69-totient-maximum.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-69-totient-maximum.english.md index e5dd069ad9..cba0e95273 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-69-totient-maximum.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-69-totient-maximum.english.md @@ -42,8 +42,10 @@ Find the value of n ≤ 1,000,000 for which n/φ(n) is a m ```yml tests: - - text: euler69() should return 510510. - testString: assert.strictEqual(euler69(), 510510); + - text: totientMaximum() should return a number. + testString: assert(typeof totientMaximum() === 'number'); + - text: totientMaximum() should return 510510. + testString: assert.strictEqual(totientMaximum(), 510510); ``` @@ -55,12 +57,12 @@ tests:
```js -function euler69() { +function totientMaximum() { // Good luck! return true; } -euler69(); +totientMaximum(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-7-10001st-prime.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-7-10001st-prime.english.md index 436dfc60b0..7af9b94ce8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-7-10001st-prime.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-7-10001st-prime.english.md @@ -7,8 +7,11 @@ forumTopicId: 302182 ## 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 nth prime number? + +What is the `n`th prime number? +
## Instructions @@ -21,6 +24,8 @@ What is the nth prime number? ```yml tests: + - text: nthPrime(6) should return a number. + testString: assert(typeof nthPrime(6) === 'number'); - text: nthPrime(6) should return 13. testString: assert.strictEqual(nthPrime(6), 13); - text: nthPrime(10) should return 29. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-70-totient-permutation.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-70-totient-permutation.english.md index 5c82bedf68..dc196fd0d0 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-70-totient-permutation.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-70-totient-permutation.english.md @@ -7,9 +7,13 @@ forumTopicId: 302183 ## 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, φ(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. + 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 n, 1 < n < 107, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum. +
## 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: euler70() should return 8319823. - testString: assert.strictEqual(euler70(), 8319823); + - text: totientPermutation() should return a number. + testString: assert(typeof totientPermutation() === 'number'); + - text: totientPermutation() should return 8319823. + testString: assert.strictEqual(totientPermutation(), 8319823); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler70() { +function totientPermutation() { // Good luck! return true; } -euler70(); +totientPermutation(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-71-ordered-fractions.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-71-ordered-fractions.english.md index 2fe5a04560..231758224f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-71-ordered-fractions.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-71-ordered-fractions.english.md @@ -7,11 +7,17 @@ forumTopicId: 302184 ## Description
-Consider the fraction, n/d, where n and d are positive integers. If nn/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
+ 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 d ≤ 1,000,000 in ascending order of size, find the numerator of the fraction immediately to the left of 3/7. +
## Instructions @@ -24,8 +30,10 @@ By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending ```yml tests: - - text: euler71() should return 428570. - testString: assert.strictEqual(euler71(), 428570); + - text: orderedFractions() should return a number. + testString: assert(typeof orderedFractions() === 'number'); + - text: orderedFractions() should return 428570. + testString: assert.strictEqual(orderedFractions(), 428570); ``` @@ -37,12 +45,12 @@ tests:
```js -function euler71() { +function orderedFractions() { // Good luck! return true; } -euler71(); +orderedFractions(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-72-counting-fractions.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-72-counting-fractions.english.md index 7238d10f04..c8e1df6c61 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-72-counting-fractions.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-72-counting-fractions.english.md @@ -7,11 +7,17 @@ forumTopicId: 302185 ## Description
-Consider the fraction, n/d, where n and d are positive integers. If nn/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
+ 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 d ≤ 1,000,000? +
## Instructions @@ -24,8 +30,10 @@ How many elements would be contained in the set of reduced proper fractions for ```yml tests: - - text: euler72() should return 303963552391. - testString: assert.strictEqual(euler72(), 303963552391); + - text: countingFractions() should return a number. + testString: assert(typeof countingFractions() === 'number'); + - text: countingFractions() should return 303963552391. + testString: assert.strictEqual(countingFractions(), 303963552391); ``` @@ -37,12 +45,12 @@ tests:
```js -function euler72() { +function countingFractions() { // Good luck! return true; } -euler72(); +countingFractions(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-73-counting-fractions-in-a-range.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-73-counting-fractions-in-a-range.english.md index c1852f7aeb..fa667257ea 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-73-counting-fractions-in-a-range.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-73-counting-fractions-in-a-range.english.md @@ -7,11 +7,17 @@ forumTopicId: 302186 ## Description
-Consider the fraction, n/d, where n and d are positive integers. If nn/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
+ 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 d ≤ 12,000? +
## 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: euler73() should return 7295372. - testString: assert.strictEqual(euler73(), 7295372); + - text: countingFractionsInARange() should return a number. + testString: assert(typeof countingFractionsInARange() === 'number'); + - text: countingFractionsInARange() should return 7295372. + testString: assert.strictEqual(countingFractionsInARange(), 7295372); ``` @@ -37,12 +45,12 @@ tests:
```js -function euler73() { +function countingFractionsInARange() { // Good luck! return true; } -euler73(); +countingFractionsInARange(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.english.md index f1df1fbbeb..541df6f962 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-74-digit-factorial-chains.english.md @@ -7,18 +7,30 @@ forumTopicId: 302187 ## 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 + +
1! + 4! + 5! = 1 + 24 + 120 = 145
+ 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 + +
+ 169 → 363601 → 1454 → 169
+ 871 → 45361 → 871
+ 872 → 45362 → 872
+
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) + +
+ 69 → 363600 → 1454 → 169 → 363601 (→ 1454)
+ 78 → 45360 → 871 → 45361 (→ 871)
+ 540 → 145 (→ 145)
+
+ 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? +
## Instructions @@ -31,8 +43,10 @@ How many chains, with a starting number below one million, contain exactly sixty ```yml tests: - - text: euler74() should return 402. - testString: assert.strictEqual(euler74(), 402); + - text: digitFactorialChains() should return a number. + testString: assert(typeof digitFactorialChains() === 'number'); + - text: digitFactorialChains() should return 402. + testString: assert.strictEqual(digitFactorialChains(), 402); ``` @@ -44,12 +58,12 @@ tests:
```js -function euler74() { +function digitFactorialChains() { // Good luck! return true; } -euler74(); +digitFactorialChains(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-75-singular-integer-right-triangles.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-75-singular-integer-right-triangles.english.md index d94be372e9..821ac93a08 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-75-singular-integer-right-triangles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-75-singular-integer-right-triangles.english.md @@ -7,11 +7,26 @@ forumTopicId: 302188 ## 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) + +
+ 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)
+
+ 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) + +
+ 120 cm: (30,40,50), (20,48,52), (24,45,51) +
+ 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? +
## 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: euler75() should return 161667. - testString: assert.strictEqual(euler75(), 161667); + - text: singularIntRightTriangles() should return a number. + testString: assert(typeof singularIntRightTriangles() === 'number'); + - text: singularIntRightTriangles() should return 161667. + testString: assert.strictEqual(singularIntRightTriangles(), 161667); ``` @@ -37,12 +54,12 @@ tests:
```js -function euler75() { +function singularIntRightTriangles() { // Good luck! return true; } -euler75(); +singularIntRightTriangles(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-76-counting-summations.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-76-counting-summations.english.md index ed80ac241c..02998670c7 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-76-counting-summations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-76-counting-summations.english.md @@ -7,14 +7,20 @@ forumTopicId: 302189 ## 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 + +
+ 4 + 1
+ 3 + 2
+ 3 + 1 + 1
+ 2 + 2 + 1
+ 2 + 1 + 1 + 1
+ 1 + 1 + 1 + 1 + 1
+
+ How many different ways can one hundred be written as a sum of at least two positive integers? +
## 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: euler76() should return 190569291. - testString: assert.strictEqual(euler76(), 190569291); + - text: countingSummations() should return a number. + testString: assert(typeof countingSummations() === 'number'); + - text: countingSummations() should return 190569291. + testString: assert.strictEqual(countingSummations(), 190569291); ``` @@ -40,12 +48,12 @@ tests:
```js -function euler76() { +function countingSummations() { // Good luck! return true; } -euler76(); +countingSummations(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-77-prime-summations.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-77-prime-summations.english.md index aec9c0a839..932b450087 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-77-prime-summations.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-77-prime-summations.english.md @@ -7,13 +7,19 @@ forumTopicId: 302190 ## 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 + +
+ 7 + 3
+ 5 + 5
+ 5 + 3 + 2
+ 3 + 3 + 2 + 2
+ 2 + 2 + 2 + 2 + 2
+
+ What is the first value which can be written as the sum of primes in over five thousand different ways? +
## 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: euler77() should return 71. - testString: assert.strictEqual(euler77(), 71); + - text: primeSummations() should return a number. + testString: assert(typeof primeSummations() === 'number'); + - text: primeSummations() should return 71. + testString: assert.strictEqual(primeSummations(), 71); ``` @@ -39,12 +47,12 @@ tests:
```js -function euler77() { +function primeSummations() { // Good luck! return true; } -euler77(); +primeSummations(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-78-coin-partitions.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-78-coin-partitions.english.md index b11e43800b..2b8f01e9c8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-78-coin-partitions.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-78-coin-partitions.english.md @@ -7,6 +7,7 @@ forumTopicId: 302191 ## 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.
@@ -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 n for which p(n) is divisible by one million. -Find the least value of n for which p(n) is divisible by one million.
## Instructions @@ -38,8 +38,10 @@ Find the least value of n for which p(n) is divisible by one million. ```yml tests: - - text: euler78() should return 55374. - testString: assert.strictEqual(euler78(), 55374); + - text: coinPartitions() should return a number. + testString: assert(typeof coinPartitions() === 'number'); + - text: coinPartitions() should return 55374. + testString: assert.strictEqual(coinPartitions(), 55374); ``` @@ -51,12 +53,12 @@ tests:
```js -function euler78() { +function coinPartitions() { // Good luck! return true; } -euler78(); +coinPartitions(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-79-passcode-derivation.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-79-passcode-derivation.english.md index eaffe826fa..504ae5740d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-79-passcode-derivation.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-79-passcode-derivation.english.md @@ -7,9 +7,13 @@ forumTopicId: 302192 ## 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. +
## Instructions @@ -22,8 +26,10 @@ Given that the three characters are always asked for in order, analyse the file ```yml tests: - - text: euler79() should return 73162890. - testString: assert.strictEqual(euler79(), 73162890); + - text: passcodeDerivation(keylog) should return a number. + testString: assert(typeof passcodeDerivation(keylog) === 'number'); + - text: passcodeDerivation(keylog) should return 73162890. + testString: assert.strictEqual(passcodeDerivation(keylog), 73162890); ``` @@ -35,12 +41,18 @@ tests:
```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); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-8-largest-product-in-a-series.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-8-largest-product-in-a-series.english.md index 04f10d3a5f..4774d4f404 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-8-largest-product-in-a-series.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-8-largest-product-in-a-series.english.md @@ -7,6 +7,7 @@ forumTopicId: 302193 ## Description
+ The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
73167176531330624919225119674426574742355349194934
@@ -29,7 +30,9 @@ The four adjacent digits in the 1000-digit number that have the greatest product
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
-Find the n 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? +
## Instructions @@ -42,6 +45,8 @@ Find the n adjacent digits in the 1000-digit number that have the g ```yml tests: + - text: largestProductinaSeries(4) should return a number. + testString: assert(typeof largestProductinaSeries(4) === 'number'); - text: largestProductinaSeries(4) should return 5832. testString: assert.strictEqual(largestProductinaSeries(4), 5832); - text: largestProductinaSeries(13) should return 23514624000. diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-80-square-root-digital-expansion.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-80-square-root-digital-expansion.english.md index 40f89764b6..29213d6baa 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-80-square-root-digital-expansion.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-80-square-root-digital-expansion.english.md @@ -7,9 +7,13 @@ forumTopicId: 302194 ## 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. +
## Instructions @@ -22,8 +26,10 @@ For the first one hundred natural numbers, find the total of the digital sums of ```yml tests: - - text: euler80() should return 40886. - testString: assert.strictEqual(euler80(), 40886); + - text: sqrtDigitalExpansion() should return a number. + testString: assert(typeof sqrtDigitalExpansion() === 'number'); + - text: sqrtDigitalExpansion() should return 40886. + testString: assert.strictEqual(sqrtDigitalExpansion(), 40886); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler80() { +function sqrtDigitalExpansion() { // Good luck! return true; } -euler80(); +sqrtDigitalExpansion(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.english.md index 703a0b7394..4668fa61bb 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-81-path-sum-two-ways.english.md @@ -7,19 +7,21 @@ forumTopicId: 302195 ## 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 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}$ +
+ +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.
## Instructions @@ -32,8 +34,12 @@ Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As.. ```yml tests: - - text: euler81() should return 427337. - testString: assert.strictEqual(euler81(), 427337); + - text: pathSumTwoWays(testMatrix) should return a number. + testString: assert(typeof pathSumTwoWays(testMatrix) === 'number'); + - text: pathSumTwoWays(testMatrix) should return 2427. + testString: assert.strictEqual(pathSumTwoWays(testMatrix), 2427); + - text: pathSumTwoWays(matrix) should return 427337. + testString: assert.strictEqual(pathSumTwoWays(matrix), 427337); ``` @@ -45,12 +51,113 @@ tests:
```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); +``` + +
+ + +### Before Test +
+ +```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] +]; ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.english.md index ac5a55f966..81e98a1c76 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-82-path-sum-three-ways.english.md @@ -7,20 +7,23 @@ forumTopicId: 302196 ## 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} -$$ +
+ $\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}$ +
+ +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.
## Instructions @@ -33,8 +36,12 @@ Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As.. ```yml tests: - - text: euler82() should return 260324. - testString: assert.strictEqual(euler82(), 260324); + - text: pathSumThreeWays(testMatrix) should return a number. + testString: assert(typeof pathSumThreeWays(testMatrix) === 'number'); + - text: pathSumThreeWays(testMatrix) should return 994. + testString: assert.strictEqual(pathSumThreeWays(testMatrix), 994); + - text: pathSumThreeWays(matrix) should return 260324. + testString: assert.strictEqual(pathSumThreeWays(matrix), 260324); ``` @@ -46,12 +53,113 @@ tests:
```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); +``` + +
+ + +### Before Test +
+ +```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] +]; ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.english.md index 42ec92358c..c0233ad266 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-83-path-sum-four-ways.english.md @@ -7,21 +7,23 @@ forumTopicId: 302197 ## 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} -$$ +
+ $\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}$ +
+ +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.
## Instructions @@ -34,8 +36,12 @@ Find the minimal path sum, in matrix.txt (right click and ```yml tests: - - text: euler83() should return 425185. - testString: assert.strictEqual(euler83(), 425185); + - text: pathSumFourWays(testMatrix) should return a number. + testString: assert(typeof pathSumFourWays(testMatrix) === 'number'); + - text: pathSumFourWays(testMatrix) should return 2297. + testString: assert.strictEqual(pathSumFourWays(testMatrix), 2297); + - text: pathSumFourWays(matrix) should return 425185. + testString: assert.strictEqual(pathSumFourWays(matrix), 425185); ``` @@ -47,12 +53,113 @@ tests:
```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); +``` + +
+ + +### Before Test +
+ +```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] +]; ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-84-monopoly-odds.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-84-monopoly-odds.english.md index db0ce673a9..253d44e2fb 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-84-monopoly-odds.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-84-monopoly-odds.english.md @@ -7,7 +7,8 @@ forumTopicId: 302198 ## Description
-In the game, Monopoly, the standard board is set up in the following way: + +In the game, Monopoly, the standard board is set up in the following way:
@@ -88,28 +89,41 @@ In the game, Monopoly, the standard board is set up in the following way: 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. + +
    +
  • Community Chest (2/16 cards):
  • +
      +
    1. Advance to GO
    2. +
    3. Go to JAIL
    4. +
    + +
  • Chance (10/16 cards):
  • +
      +
    1. Advance to GO
    2. +
    3. Go to JAIL
    4. +
    5. Go to C1
    6. +
    7. Go to E3
    8. +
    9. Go to H2
    10. +
    11. Go to R1
    12. +
    13. Go to next R (railway company)
    14. +
    15. Go to next R
    16. +
    17. Go to next U (utility company)
    18. +
    19. Go back 3 squares.
    20. +
    +
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. + ## 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: euler84() should return 101524. - testString: assert.strictEqual(euler84(), 101524); + - text: monopolyOdds() should return a number. + testString: assert(typeof monopolyOdds() === 'number'); + - text: monopolyOdds() should return 101524. + testString: assert.strictEqual(monopolyOdds(), 101524); ``` @@ -135,12 +151,12 @@ tests:
```js -function euler84() { +function monopolyOdds() { // Good luck! return true; } -euler84(); +monopolyOdds(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-85-counting-rectangles.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-85-counting-rectangles.english.md index bc1582f41b..fa865c5c2d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-85-counting-rectangles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-85-counting-rectangles.english.md @@ -7,10 +7,13 @@ forumTopicId: 302199 ## Description
+ By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: +a diagram of the different rectangles found within a 3 by 2 rectangular grid Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution. +
## Instructions @@ -23,8 +26,10 @@ Although there exists no rectangular grid that contains exactly two million rect ```yml tests: - - text: euler85() should return 2772. - testString: assert.strictEqual(euler85(), 2772); + - text: countingRectangles() should return a number. + testString: assert(typeof countingRectangles() === 'number'); + - text: countingRectangles() should return 2772. + testString: assert.strictEqual(countingRectangles(), 2772); ``` @@ -36,12 +41,12 @@ tests:
```js -function euler85() { +function countingRectangles() { // Good luck! return true; } -euler85(); +countingRectangles(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-86-cuboid-route.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-86-cuboid-route.english.md index 8ac9d3114c..02f963b331 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-86-cuboid-route.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-86-cuboid-route.english.md @@ -7,12 +7,17 @@ forumTopicId: 302200 ## 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. +a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner 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. +
## Instructions @@ -25,8 +30,10 @@ Find the least value of M such that the number of solutions first exceeds one mi ```yml tests: - - text: euler86() should return 1818. - testString: assert.strictEqual(euler86(), 1818); + - text: cuboidRoute() should return a number. + testString: assert(typeof cuboidRoute() === 'number'); + - text: cuboidRoute() should return 1818. + testString: assert.strictEqual(cuboidRoute(), 1818); ``` @@ -38,12 +45,12 @@ tests:
```js -function euler86() { +function cuboidRoute() { // Good luck! return true; } -euler86(); +cuboidRoute(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-87-prime-power-triples.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-87-prime-power-triples.english.md index e99be76a69..3cd4355e3d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-87-prime-power-triples.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-87-prime-power-triples.english.md @@ -7,12 +7,18 @@ forumTopicId: 302201 ## 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 + +
+ 28 = 22 + 23 + 24
+ 33 = 32 + 23 + 24
+ 49 = 52 + 23 + 24
+ 47 = 22 + 33 + 24 +
+ How many numbers below fifty million can be expressed as the sum of a prime square, prime cube, and prime fourth power? +
## Instructions @@ -25,8 +31,10 @@ How many numbers below fifty million can be expressed as the sum of a prime squa ```yml tests: - - text: euler87() should return 1097343. - testString: assert.strictEqual(euler87(), 1097343); + - text: primePowerTriples() should return a number. + testString: assert(typeof primePowerTriples() === 'number'); + - text: primePowerTriples() should return 1097343. + testString: assert.strictEqual(primePowerTriples(), 1097343); ``` @@ -38,12 +46,12 @@ tests:
```js -function euler87() { +function primePowerTriples() { // Good luck! return true; } -euler87(); +primePowerTriples(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-88-product-sum-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-88-product-sum-numbers.english.md index 20339026ae..b9e7cfa883 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-88-product-sum-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-88-product-sum-numbers.english.md @@ -7,13 +7,27 @@ forumTopicId: 302203 ## 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, {a1, a2, ... , ak} is called a product-sum number: N = a1 + a2 + ... + ak = a1 × a2 × ... × ak. + 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, 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 + 2
+ k=3: 6 = 1 × 2 × 3 = 1 + 2 + 3
+ k=4: 8 = 1 × 1 × 2 × 4 = 1 + 1 + 2 + 4
+ k=5: 8 = 1 × 1 × 2 × 2 × 2 = 1 + 1 + 2 + 2 + 2
+ k=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? +
## Instructions @@ -26,8 +40,10 @@ What is the sum of all the minimal product-sum numbers for 2≤k≤12000? ```yml tests: - - text: euler88() should return 7587457. - testString: assert.strictEqual(euler88(), 7587457); + - text: productSumNumbers() should return a number. + testString: assert(typeof productSumNumbers() === 'number'); + - text: productSumNumbers() should return 7587457. + testString: assert.strictEqual(productSumNumbers(), 7587457); ``` @@ -39,12 +55,12 @@ tests:
```js -function euler88() { +function productSumNumbers() { // Good luck! return true; } -euler88(); +productSumNumbers(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-89-roman-numerals.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-89-roman-numerals.english.md index 0963df42f5..21861f85bc 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-89-roman-numerals.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-89-roman-numerals.english.md @@ -7,18 +7,28 @@ forumTopicId: 302204 ## Description
+ For a number written in Roman numerals to be considered valid there are basic rules which must be followed. Even though the rules allow some numbers to be expressed in more than one way there is always a "best" way of writing a particular number. + For example, it would appear that there are at least six ways of writing the number sixteen: -IIIIIIIIIIIIIIII -VIIIIIIIIIII -VVIIIIII -XIIIIII -VVVI -XVI -However, according to the rules only XIIIIII and XVI are valid, and the last example is considered to be the most efficient, as it uses the least number of numerals. -The 11K text file, roman.txt (right click and 'Save Link/Target As...'), contains one thousand numbers written in valid, but not necessarily minimal, Roman numerals; see About... Roman Numerals for the definitive rules for this problem. + +
+ IIIIIIIIIIIIIIII
+ VIIIIIIIIIII
+ VVIIIIII
+ XIIIIII
+ VVVI
+ XVI
+
+ +However, according to the rules only XIIIIII and XVI are valid, and the last example is considered to be the most efficient, as it uses the least number of numerals. + +The array, `roman`, contains one thousand numbers written in valid, but not necessarily minimal, Roman numerals; see About... Roman Numerals for the definitive rules for this problem. + Find the number of characters saved by writing each of these in their minimal form. -Note: You can assume that all the Roman numerals in the file contain no more than four consecutive identical units. + +**Note:** You can assume that all the Roman numerals in the array contain no more than four consecutive identical units. +
## Instructions @@ -31,8 +41,10 @@ Note: You can assume that all the Roman numerals in the file contain no more tha ```yml tests: - - text: euler89() should return 743. - testString: assert.strictEqual(euler89(), 743); + - text: romanNumerals(roman) should return a number. + testString: assert(typeof romanNumerals(roman) === 'number'); + - text: romanNumerals(roman) should return 743. + testString: assert.strictEqual(romanNumerals(roman), 743); ``` @@ -44,12 +56,18 @@ tests:
```js -function euler89() { +function romanNumerals(arr) { // Good luck! return true; } -euler89(); +// Only change code above this line + +const roman = [ + 'MMMMDCLXXII','MMDCCCLXXXIII','MMMDLXVIIII','MMMMDXCV','DCCCLXXII','MMCCCVI','MMMCDLXXXVII','MMMMCCXXI','MMMCCXX','MMMMDCCCLXXIII','MMMCCXXXVII','MMCCCLXXXXIX','MDCCCXXIIII','MMCXCVI','CCXCVIII','MMMCCCXXXII','MDCCXXX','MMMDCCCL','MMMMCCLXXXVI','MMDCCCXCVI','MMMDCII','MMMCCXII','MMMMDCCCCI','MMDCCCXCII','MDCXX','CMLXXXVII','MMMXXI','MMMMCCCXIV','MLXXII','MCCLXXVIIII','MMMMCCXXXXI','MMDCCCLXXII','MMMMXXXI','MMMDCCLXXX','MMDCCCLXXIX','MMMMLXXXV','MCXXI','MDCCCXXXVII','MMCCCLXVII','MCDXXXV','CCXXXIII','CMXX','MMMCLXIV','MCCCLXXXVI','DCCCXCVIII','MMMDCCCCXXXIV','CDXVIIII','MMCCXXXV','MDCCCXXXII','MMMMD','MMDCCLXIX','MMMMCCCLXXXXVI','MMDCCXLII','MMMDCCCVIIII','DCCLXXXIIII','MDCCCCXXXII','MMCXXVII','DCCCXXX','CCLXIX','MMMXI','MMMMCMLXXXXVIII','MMMMDLXXXVII','MMMMDCCCLX','MMCCLIV','CMIX','MMDCCCLXXXIIII','CLXXXII','MMCCCCXXXXV','MMMMDLXXXVIIII','MMMDCCCXXI','MMDCCCCLXXVI','MCCCCLXX','MMCDLVIIII','MMMDCCCLIX','MMMMCCCCXIX','MMMDCCCLXXV','XXXI','CDLXXXIII','MMMCXV','MMDCCLXIII','MMDXXX','MMMMCCCLVII','MMMDCI','MMMMCDLXXXIIII','MMMMCCCXVI','CCCLXXXVIII','MMMMCML','MMMMXXIV','MMMCCCCXXX','DCCX','MMMCCLX','MMDXXXIII','CCCLXIII','MMDCCXIII','MMMCCCXLIV','CLXXXXI','CXVI','MMMMCXXXIII','CLXX','DCCCXVIII','MLXVII','DLXXXX','MMDXXI','MMMMDLXXXXVIII','MXXII','LXI','DCCCCXLIII','MMMMDV','MMMMXXXIV','MDCCCLVIII','MMMCCLXXII','MMMMDCCXXXVI','MMMMLXXXIX','MDCCCLXXXI','MMMMDCCCXV','MMMMCCCCXI','MMMMCCCLIII','MDCCCLXXI','MMCCCCXI','MLXV','MMCDLXII','MMMMDXXXXII','MMMMDCCCXL','MMMMCMLVI','CCLXXXIV','MMMDCCLXXXVI','MMCLII','MMMCCCCXV','MMLXXXIII','MMMV','MMMV','DCCLXII','MMDCCCCXVI','MMDCXLVIII','CCLIIII','CCCXXV','MMDCCLXXXVIIII','MMMMDCLXXVIII','MMMMDCCCXCI','MMMMCCCXX','MMCCXLV','MMMDCCCLXIX','MMCCLXIIII','MMMDCCCXLIX','MMMMCCCLXIX','CMLXXXXI','MCMLXXXIX','MMCDLXI','MMDCLXXVIII','MMMMDCCLXI','MCDXXV','DL','CCCLXXII','MXVIIII','MCCCCLXVIII','CIII','MMMDCCLXXIIII','MMMDVIII','MMMMCCCLXXXXVII','MMDXXVII','MMDCCLXXXXV','MMMMCXLVI','MMMDCCLXXXII','MMMDXXXVI','MCXXII','CLI','DCLXXXIX','MMMCLI','MDCLXIII','MMMMDCCXCVII','MMCCCLXXXV','MMMDCXXVIII','MMMCDLX','MMMCMLII','MMMIV','MMMMDCCCLVIII','MMMDLXXXVIII','MCXXIV','MMMMLXXVI','CLXXIX','MMMCCCCXXVIIII','DCCLXXXV','MMMDCCCVI','LI','CLXXXVI','MMMMCCCLXXVI','MCCCLXVI','CCXXXIX','MMDXXXXI','MMDCCCXLI','DCCCLXXXVIII','MMMMDCCCIV','MDCCCCXV','MMCMVI','MMMMCMLXXXXV','MMDCCLVI','MMMMCCXLVIII','DCCCCIIII','MMCCCCIII','MMMDCCLXXXVIIII','MDCCCLXXXXV','DVII','MMMV','DCXXV','MMDCCCXCV','DCVIII','MMCDLXVI','MCXXVIII','MDCCXCVIII','MMDCLX','MMMDCCLXIV','MMCDLXXVII','MMDLXXXIIII','MMMMCCCXXII','MMMDCCCXLIIII','DCCCCLXVII','MMMCLXXXXIII','MCCXV','MMMMDCXI','MMMMDCLXXXXV','MMMCCCLII','MMCMIX','MMDCCXXV','MMDLXXXVI','MMMMDCXXVIIII','DCCCCXXXVIIII','MMCCXXXIIII','MMDCCLXXVIII','MDCCLXVIIII','MMCCLXXXV','MMMMDCCCLXXXVIII','MMCMXCI','MDXLII','MMMMDCCXIV','MMMMLI','DXXXXIII','MMDCCXI','MMMMCCLXXXIII','MMMDCCCLXXIII','MDCLVII','MMCD','MCCCXXVII','MMMMDCCIIII','MMMDCCXLVI','MMMCLXXXVII','MMMCCVIIII','MCCCCLXXIX','DL','DCCCLXXVI','MMDXCI','MMMMDCCCCXXXVI','MMCII','MMMDCCCXXXXV','MMMCDXLV','MMDCXXXXIV','MMD','MDCCCLXXXX','MMDCXLIII','MMCCXXXII','MMDCXXXXVIIII','DCCCLXXI','MDXCVIIII','MMMMCCLXXVIII','MDCLVIIII','MMMCCCLXXXIX','MDCLXXXV','MDLVIII','MMMMCCVII','MMMMDCXIV','MMMCCCLXIIII','MMIIII','MMMMCCCLXXIII','CCIII','MMMCCLV','MMMDXIII','MMMCCCXC','MMMDCCCXXI','MMMMCCCCXXXII','CCCLVI','MMMCCCLXXXVI','MXVIIII','MMMCCCCXIIII','CLXVII','MMMCCLXX','CCCCLXIV','MMXXXXII','MMMMCCLXXXX','MXL','CCXVI','CCCCLVIIII','MMCCCII','MCCCLVIII','MMMMCCCX','MCDLXXXXIV','MDCCCXIII','MMDCCCXL','MMMMCCCXXIII','DXXXIV','CVI','MMMMDCLXXX','DCCCVII','MMCMLXIIII','MMMDCCCXXXIII','DCCC','MDIII','MMCCCLXVI','MMMCCCCLXXI','MMDCCCCXVIII','CCXXXVII','CCCXXV','MDCCCXII','MMMCMV','MMMMCMXV','MMMMDCXCI','DXXI','MMCCXLVIIII','MMMMCMLII','MDLXXX','MMDCLXVI','CXXI','MMMDCCCLIIII','MMMCXXI','MCCIII','MMDCXXXXI','CCXCII','MMMMDXXXV','MMMCCCLXV','MMMMDLXV','MMMCCCCXXXII','MMMCCCVIII','DCCCCLXXXXII','MMCLXIV','MMMMCXI','MLXXXXVII','MMMCDXXXVIII','MDXXII','MLV','MMMMDLXVI','MMMCXII','XXXIII','MMMMDCCCXXVI','MMMLXVIIII','MMMLX','MMMCDLXVII','MDCCCLVII','MMCXXXVII','MDCCCCXXX','MMDCCCLXIII','MMMMDCXLIX','MMMMCMXLVIII','DCCCLXXVIIII','MDCCCLIII','MMMCMLXI','MMMMCCLXI','MMDCCCLIII','MMMDCCCVI','MMDXXXXIX','MMCLXXXXV','MMDXXX','MMMXIII','DCLXXIX','DCCLXII','MMMMDCCLXVIII','MDCCXXXXIII','CCXXXII','MMMMDCXXV','MMMCCCXXVIII','MDCVIII','MMMCLXXXXIIII','CLXXXI','MDCCCCXXXIII','MMMMDCXXX','MMMDCXXIV','MMMCCXXXVII','MCCCXXXXIIII','CXVIII','MMDCCCCIV','MMMMCDLXXV','MMMDLXIV','MDXCIII','MCCLXXXI','MMMDCCCXXIV','MCXLIII','MMMDCCCI','MCCLXXX','CCXV','MMDCCLXXI','MMDLXXXIII','MMMMDCXVII','MMMCMLXV','MCLXVIII','MMMMCCLXXVI','MMMDCCLXVIIII','MMMMDCCCIX','DLXXXXIX','DCCCXXII','MMMMIII','MMMMCCCLXXVI','DCCCXCIII','DXXXI','MXXXIIII','CCXII','MMMDCCLXXXIIII','MMMCXX','MMMCMXXVII','DCCCXXXX','MMCDXXXVIIII','MMMMDCCXVIII','LV','MMMDCCCCVI','MCCCII','MMCMLXVIIII','MDCCXI','MMMMDLXVII','MMCCCCLXI','MMDCCV','MMMCCCXXXIIII','MMMMDI','MMMDCCCXCV','MMDCCLXXXXI','MMMDXXVI','MMMDCCCLVI','MMDCXXX','MCCCVII','MMMMCCCLXII','MMMMXXV','MMCMXXV','MMLVI','MMDXXX','MMMMCVII','MDC','MCCIII','MMMMDCC','MMCCLXXV','MMDCCCXXXXVI','MMMMCCCLXV','CDXIIII','MLXIIII','CCV','MMMCMXXXI','CCCCLXVI','MDXXXII','MMMMCCCLVIII','MMV','MMMCLII','MCMLI','MMDCCXX','MMMMCCCCXXXVI','MCCLXXXI','MMMCMVI','DCCXXX','MMMMCCCLXV','DCCCXI','MMMMDCCCXIV','CCCXXI','MMDLXXV','CCCCLXXXX','MCCCLXXXXII','MMDCIX','DCCXLIIII','DXIV','MMMMCLII','CDLXI','MMMCXXVII','MMMMDCCCCLXIII','MMMDCLIIII','MCCCCXXXXII','MMCCCLX','CCCCLIII','MDCCLXXVI','MCMXXIII','MMMMDLXXVIII','MMDCCCCLX','MMMCCCLXXXX','MMMCDXXVI','MMMDLVIII','CCCLXI','MMMMDCXXII','MMDCCCXXI','MMDCCXIII','MMMMCLXXXVI','MDCCCCXXVI','MDV','MMDCCCCLXXVI','MMMMCCXXXVII','MMMDCCLXXVIIII','MMMCCCCLXVII','DCCXLI','MMCLXXXVIII','MCCXXXVI','MMDCXLVIII','MMMMCXXXII','MMMMDCCLXVI','MMMMCMLI','MMMMCLXV','MMMMDCCCXCIV','MCCLXXVII','LXXVIIII','DCCLII','MMMCCCXCVI','MMMCLV','MMDCCCXXXXVIII','DCCCXV','MXC','MMDCCLXXXXVII','MMMMCML','MMDCCCLXXVIII','DXXI','MCCCXLI','DCLXXXXI','MMCCCLXXXXVIII','MDCCCCLXXVIII','MMMMDXXV','MMMDCXXXVI','MMMCMXCVII','MMXVIIII','MMMDCCLXXIV','MMMCXXV','DXXXVIII','MMMMCLXVI','MDXII','MMCCCLXX','CCLXXI','DXIV','MMMCLIII','DLII','MMMCCCXLIX','MMCCCCXXVI','MMDCXLIII','MXXXXII','CCCLXXXV','MDCLXXVI','MDCXII','MMMCCCLXXXIII','MMDCCCCLXXXII','MMMMCCCLXXXV','MMDCXXI','DCCCXXX','MMMDCCCCLII','MMMDCCXXII','MMMMCDXCVIII','MMMCCLXVIIII','MMXXV','MMMMCDXIX','MMMMCCCX','MMMCCCCLXVI','MMMMDCLXXVIIII','MMMMDCXXXXIV','MMMCMXII','MMMMXXXIII','MMMMDLXXXII','DCCCLIV','MDXVIIII','MMMCLXXXXV','CCCCXX','MMDIX','MMCMLXXXVIII','DCCXLIII','DCCLX','D','MCCCVII','MMMMCCCLXXXIII','MDCCCLXXIIII','MMMDCCCCLXXXVII','MMMMCCCVII','MMMDCCLXXXXVI','CDXXXIV','MCCLXVIII','MMMMDLX','MMMMDXII','MMMMCCCCLIIII','MCMLXXXXIII','MMMMDCCCIII','MMDCLXXXIII','MDCCCXXXXIV','XXXXVII','MMMDCCCXXXII','MMMDCCCXLII','MCXXXV','MDCXXVIIII','MMMCXXXXIIII','MMMMCDXVII','MMMDXXIII','MMMMCCCCLXI','DCLXXXXVIIII','LXXXXI','CXXXIII','MCDX','MCCLVII','MDCXXXXII','MMMCXXIV','MMMMLXXXX','MMDCCCCXLV','MLXXX','MMDCCCCLX','MCDLIII','MMMCCCLXVII','MMMMCCCLXXIV','MMMDCVIII','DCCCCXXIII','MMXCI','MMDCCIV','MMMMDCCCXXXIV','CCCLXXI','MCCLXXXII','MCMIII','CCXXXI','DCCXXXVIII','MMMMDCCXLVIIII','MMMMCMXXXV','DCCCLXXV','DCCXCI','MMMMDVII','MMMMDCCCLXVIIII','CCCXCV','MMMMDCCXX','MCCCCII','MMMCCCXC','MMMCCCII','MMDCCLXXVII','MMDCLIIII','CCXLIII','MMMDCXVIII','MMMCCCIX','MCXV','MMCCXXV','MLXXIIII','MDCCXXVI','MMMCCCXX','MMDLXX','MMCCCCVI','MMDCCXX','MMMMDCCCCXCV','MDCCCXXXII','MMMMDCCCCXXXX','XCIV','MMCCCCLX','MMXVII','MLXXI','MMMDXXVIII','MDCCCCII','MMMCMLVII','MMCLXXXXVIII','MDCCCCLV','MCCCCLXXIIII','MCCCLII','MCDXLVI','MMMMDXVIII','DCCLXXXIX','MMMDCCLXIV','MDCCCCXLIII','CLXXXXV','MMMMCCXXXVI','MMMDCCCXXI','MMMMCDLXXVII','MCDLIII','MMCCXLVI','DCCCLV','MCDLXX','DCLXXVIII','MMDCXXXIX','MMMMDCLX','MMDCCLI','MMCXXXV','MMMCCXII','MMMMCMLXII','MMMMCCV','MCCCCLXIX','MMMMCCIII','CLXVII','MCCCLXXXXIIII','MMMMDCVIII','MMDCCCLXI','MMLXXIX','CMLXIX','MMDCCCXLVIIII','DCLXII','MMMCCCXLVII','MDCCCXXXV','MMMMDCCXCVI','DCXXX','XXVI','MMLXIX','MMCXI','DCXXXVII','MMMMCCCXXXXVIII','MMMMDCLXI','MMMMDCLXXIIII','MMMMVIII','MMMMDCCCLXII','MDCXCI','MMCCCXXIIII','CCCCXXXXV','MMDCCCXXI','MCVI','MMDCCLXVIII','MMMMCXL','MLXVIII','CMXXVII','CCCLV','MDCCLXXXIX','MMMCCCCLXV','MMDCCLXII','MDLXVI','MMMCCCXVIII','MMMMCCLXXXI','MMCXXVII','MMDCCCLXVIII','MMMCXCII','MMMMDCLVIII','MMMMDCCCXXXXII','MMDCCCCLXXXXVI','MDCCXL','MDCCLVII','MMMMDCCCLXXXVI','DCCXXXIII','MMMMDCCCCLXXXV','MMCCXXXXVIII','MMMCCLXXVIII','MMMDCLXXVIII','DCCCI','MMMMLXXXXVIIII','MMMCCCCLXXII','MMCLXXXVII','CCLXVI','MCDXLIII','MMCXXVIII','MDXIV','CCCXCVIII','CLXXVIII','MMCXXXXVIIII','MMMDCLXXXIV','CMLVIII','MCDLIX','MMMMDCCCXXXII','MMMMDCXXXIIII','MDCXXI','MMMDCXLV','MCLXXVIII','MCDXXII','IV','MCDLXXXXIII','MMMMDCCLXV','CCLI','MMMMDCCCXXXVIII','DCLXII','MCCCLXVII','MMMMDCCCXXXVI','MMDCCXLI','MLXI','MMMCDLXVIII','MCCCCXCIII','XXXIII','MMMDCLXIII','MMMMDCL','DCCCXXXXIIII','MMDLVII','DXXXVII','MCCCCXXIIII','MCVII','MMMMDCCXL','MMMMCXXXXIIII','MCCCCXXIV','MMCLXVIII','MMXCIII','MDCCLXXX','MCCCLIIII','MMDCLXXI','MXI','MCMLIV','MMMCCIIII','DCCLXXXVIIII','MDCLIV','MMMDCXIX','CMLXXXI','DCCLXXXVII','XXV','MMMXXXVI','MDVIIII','CLXIII','MMMCDLVIIII','MMCCCCVII','MMMLXX','MXXXXII','MMMMCCCLXVIII','MMDCCCXXVIII','MMMMDCXXXXI','MMMMDCCCXXXXV','MMMXV','MMMMCCXVIIII','MMDCCXIIII','MMMXXVII','MDCCLVIIII','MMCXXIIII','MCCCLXXIV','DCLVIII','MMMLVII','MMMCXLV','MMXCVII','MMMCCCLXXXVII','MMMMCCXXII','DXII','MMMDLV','MCCCLXXVIII','MMMCLIIII','MMMMCLXXXX','MMMCLXXXIIII','MDCXXIII','MMMMCCXVI','MMMMDLXXXIII','MMMDXXXXIII','MMMMCCCCLV','MMMDLXXXI','MMMCCLXXVI','MMMMXX','MMMMDLVI','MCCCCLXXX','MMMXXII','MMXXII','MMDCCCCXXXI','MMMDXXV','MMMDCLXXXVIIII','MMMDLXXXXVII','MDLXIIII','CMXC','MMMXXXVIII','MDLXXXVIII','MCCCLXXVI','MMCDLIX','MMDCCCXVIII','MDCCCXXXXVI','MMMMCMIV','MMMMDCIIII','MMCCXXXV','XXXXVI','MMMMCCXVII','MMCCXXIV','MCMLVIIII','MLXXXIX','MMMMLXXXIX','CLXXXXIX','MMMDCCCCLVIII','MMMMCCLXXIII','MCCCC','DCCCLIX','MMMCCCLXXXII','MMMCCLXVIIII','MCLXXXV','CDLXXXVII','DCVI','MMX','MMCCXIII','MMMMDCXX','MMMMXXVIII','DCCCLXII','MMMMCCCXLIII','MMMMCLXV','DXCI','MMMMCLXXX','MMMDCCXXXXI','MMMMXXXXVI','DCLX','MMMCCCXI','MCCLXXX','MMCDLXXII','DCCLXXI','MMMCCCXXXVI','MCCCCLXXXVIIII','CDLVIII','DCCLVI','MMMMDCXXXVIII','MMCCCLXXXIII','MMMMDCCLXXV','MMMXXXVI','CCCLXXXXIX','CV','CCCCXIII','CCCCXVI','MDCCCLXXXIIII','MMDCCLXXXII','MMMMCCCCLXXXI','MXXV','MMCCCLXXVIIII','MMMCCXII','MMMMCCXXXIII','MMCCCLXXXVI','MMMDCCCLVIIII','MCCXXXVII','MDCLXXV','XXXV','MMDLI','MMMCCXXX','MMMMCXXXXV','CCCCLIX','MMMMDCCCLXXIII','MMCCCXVII','DCCCXVI','MMMCCCXXXXV','MDCCCCXCV','CLXXXI','MMMMDCCLXX','MMMDCCCIII','MMCLXXVII','MMMDCCXXIX','MMDCCCXCIIII','MMMCDXXIIII','MMMMXXVIII','MMMMDCCCCLXVIII','MDCCCXX','MMMMCDXXI','MMMMDLXXXIX','CCXVI','MDVIII','MMCCLXXI','MMMDCCCLXXI','MMMCCCLXXVI','MMCCLXI','MMMMDCCCXXXIV','DLXXXVI','MMMMDXXXII','MMMXXIIII','MMMMCDIV','MMMMCCCXLVIII','MMMMCXXXVIII','MMMCCCLXVI','MDCCXVIII','MMCXX','CCCLIX','MMMMDCCLXXII','MDCCCLXXV','MMMMDCCCXXIV','DCCCXXXXVIII','MMMDCCCCXXXVIIII','MMMMCCXXXV','MDCLXXXIII','MMCCLXXXIV','MCLXXXXIIII','DXXXXIII','MCCCXXXXVIII','MMCLXXIX','MMMMCCLXIV','MXXII','MMMCXIX','MDCXXXVII','MMDCCVI','MCLXXXXVIII','MMMCXVI','MCCCLX','MMMCDX','CCLXVIIII','MMMCCLX','MCXXVIII','LXXXII','MCCCCLXXXI','MMMI','MMMCCCLXIV','MMMCCCXXVIIII','CXXXVIII','MMCCCXX','MMMCCXXVIIII','MCCLXVI','MMMCCCCXXXXVI','MMDCCXCIX','MCMLXXI','MMCCLXVIII','CDLXXXXIII','MMMMDCCXXII','MMMMDCCLXXXVII','MMMDCCLIV','MMCCLXIII','MDXXXVII','DCCXXXIIII','MCII','MMMDCCCLXXI','MMMLXXIII','MDCCCLIII','MMXXXVIII','MDCCXVIIII','MDCCCCXXXVII','MMCCCXVI','MCMXXII','MMMCCCLVIII','MMMMDCCCXX','MCXXIII','MMMDLXI','MMMMDXXII','MDCCCX','MMDXCVIIII','MMMDCCCCVIII','MMMMDCCCCXXXXVI','MMDCCCXXXV','MMCXCIV','MCMLXXXXIII','MMMCCCLXXVI','MMMMDCLXXXV','CMLXIX','DCXCII','MMXXVIII','MMMMCCCXXX','XXXXVIIII' +]; + +romanNumerals(roman); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet.english.md index ea07f62868..d5da0fa3e6 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-9-special-pythagorean-triplet.english.md @@ -7,10 +7,15 @@ forumTopicId: 302205 ## Description
+ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, +
a2 + b2 = c2
+ For example, 32 + 42 = 9 + 16 = 25 = 52. -There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc such that a + b + c = n. + +There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc such that a + b + c = `n`. +
## Instructions @@ -23,12 +28,14 @@ There exists exactly one Pythagorean triplet for which a + bspecialPythagoreanTriplet(1000) should return 31875000. - testString: assert.strictEqual(specialPythagoreanTriplet(1000), 31875000); + - text: specialPythagoreanTriplet(24) should return a number. + testString: assert(typeof specialPythagoreanTriplet(24) === 'number'); - text: specialPythagoreanTriplet(24) should return 480. testString: assert.strictEqual(specialPythagoreanTriplet(24), 480); - text: specialPythagoreanTriplet(120) should return 49920, 55080 or 60000 testString: assert([49920, 55080, 60000].includes(specialPythagoreanTriplet(120))); + - text: specialPythagoreanTriplet(1000) should return 31875000. + testString: assert.strictEqual(specialPythagoreanTriplet(1000), 31875000); ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.english.md index 631231592e..70d46f992f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-90-cube-digit-pairs.english.md @@ -7,12 +7,12 @@ forumTopicId: 302207 ## 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: - - +two cubes, one with the number 6 and the other with number 4 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} +
+ {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} +
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? +
## Instructions @@ -40,8 +43,10 @@ How many distinct arrangements of the two cubes allow for all of the square numb ```yml tests: - - text: euler90() should return 1217. - testString: assert.strictEqual(euler90(), 1217); + - text: cubeDigitPairs() should return a number. + testString: assert(typeof cubeDigitPairs() === 'number'); + - text: cubeDigitPairs() should return 1217. + testString: assert.strictEqual(cubeDigitPairs(), 1217); ``` @@ -53,12 +58,12 @@ tests:
```js -function euler90() { +function cubeDigitPairs() { // Good luck! return true; } -euler90(); +cubeDigitPairs(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.english.md index f7a9a21464..6f189cd957 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-91-right-triangles-with-integer-coordinates.english.md @@ -7,17 +7,17 @@ forumTopicId: 302208 ## 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 (x1, y1) and Q (x2, y2) are plotted at integer co-ordinates and are joined to the origin, O(0,0), to form ΔOPQ. +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) +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 ≤ x1, y1, x2, y2 ≤ 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. +a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2 +Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed? - - -Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed?
## Instructions @@ -30,8 +30,10 @@ Given that 0 ≤ x1, y1, x2, y2 ≤ 50, how many right triangles can be formed? ```yml tests: - - text: euler91() should return 14234. - testString: assert.strictEqual(euler91(), 14234); + - text: rightTrianglesIntCoords() should return a number. + testString: assert(typeof rightTrianglesIntCoords() === 'number'); + - text: rightTrianglesIntCoords() should return 14234. + testString: assert.strictEqual(rightTrianglesIntCoords(), 14234); ``` @@ -43,12 +45,12 @@ tests:
```js -function euler91() { +function rightTrianglesIntCoords() { // Good luck! return true; } -euler91(); +rightTrianglesIntCoords(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-92-square-digit-chains.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-92-square-digit-chains.english.md index c903a4b181..1f13e0baf5 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-92-square-digit-chains.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-92-square-digit-chains.english.md @@ -7,12 +7,20 @@ forumTopicId: 302209 ## 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 + +
+ 44 → 32 → 13 → 10 → 11
+ 85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89 +
+ 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? +
## Instructions @@ -25,8 +33,10 @@ How many starting numbers below ten million will arrive at 89? ```yml tests: - - text: euler92() should return 8581146. - testString: assert.strictEqual(euler92(), 8581146); + - text: squareDigitChains() should return a number. + testString: assert(typeof squareDigitChains() === 'number'); + - text: squareDigitChains() should return 8581146. + testString: assert.strictEqual(squareDigitChains(), 8581146); ``` @@ -38,12 +48,12 @@ tests:
```js -function euler92() { +function squareDigitChains() { // Good luck! return true; } -euler92(); +squareDigitChains(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-93-arithmetic-expressions.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-93-arithmetic-expressions.english.md index e1bd07c6e7..25d4ff6f54 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-93-arithmetic-expressions.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-93-arithmetic-expressions.english.md @@ -7,15 +7,24 @@ forumTopicId: 302210 ## 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) + +
+ 8 = (4 * (1 + 3)) / 2
+ 14 = 4 * (3 + 1 / 2)
+ 19 = 4 * (2 + 3) − 1
+ 36 = 3 * 4 * (2 + 1) +
+ 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, 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. +
## 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: euler93() should return 1258. - testString: assert.strictEqual(euler93(), 1258); + - text: arithmeticExpressions() should return a number. + testString: assert(typeof arithmeticExpressions() === 'number'); + - text: arithmeticExpressions() should return 1258. + testString: assert.strictEqual(arithmeticExpressions(), 1258); ``` @@ -41,12 +52,12 @@ tests:
```js -function euler93() { +function arithmeticExpressions() { // Good luck! return true; } -euler93(); +arithmeticExpressions(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md index 4ef5b8d46c..eed036df98 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-94-almost-equilateral-triangles.english.md @@ -7,9 +7,13 @@ forumTopicId: 302211 ## 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 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 triangle with integral side lengths and area and whose perimeters do not exceed one billion (1,000,000,000). +
## Instructions @@ -22,8 +26,10 @@ Find the sum of the perimeters of all almost equilateral triangles with integral ```yml tests: - - text: euler94() should return 518408346. - testString: assert.strictEqual(euler94(), 518408346); + - text: almostEquilateralTriangles() should return a number. + testString: assert(typeof almostEquilateralTriangles() === 'number'); + - text: almostEquilateralTriangles() should return 518408346. + testString: assert.strictEqual(almostEquilateralTriangles(), 518408346); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler94() { +function almostEquilateralTriangles() { // Good luck! return true; } -euler94(); +almostEquilateralTriangles(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-95-amicable-chains.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-95-amicable-chains.english.md index 5ba27b2834..33329c98c4 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-95-amicable-chains.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-95-amicable-chains.english.md @@ -7,12 +7,21 @@ forumTopicId: 302212 ## 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 → ...) + +
+ 12496 → 14288 → 15472 → 14536 → 14264 (→ 12496 → ...) +
+ 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. +
## Instructions @@ -25,8 +34,10 @@ Find the smallest member of the longest amicable chain with no element exceeding ```yml tests: - - text: euler95() should return 14316. - testString: assert.strictEqual(euler95(), 14316); + - text: amicableChains() should return a number. + testString: assert(typeof amicableChains() === 'number'); + - text: amicableChains() should return 14316. + testString: assert.strictEqual(amicableChains(), 14316); ``` @@ -38,12 +49,12 @@ tests:
```js -function euler95() { +function amicableChains() { // Good luck! return true; } -euler95(); +amicableChains(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-96-su-doku.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-96-su-doku.english.md index cdd6ea3fbd..70c94d8d11 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-96-su-doku.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-96-su-doku.english.md @@ -7,8 +7,8 @@ forumTopicId: 302213 ## 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 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.
@@ -101,8 +101,11 @@ Su Doku (Japanese meaning number place) is the name given to a popular puzzle co 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. + ## 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: euler96() should return 24702. - testString: assert.strictEqual(euler96(), 24702); + - text: suDoku(testPuzzles) should return a number. + testString: assert(typeof suDoku(testPuzzles) === 'number'); + - text: suDoku(testPuzzles) should return 1190. + testString: assert.strictEqual(suDoku(testPuzzles), 1190); + - text: suDoku(puzzlesArr) should return 24702. + testString: assert.strictEqual(suDoku(puzzlesArr), 24702); ``` @@ -128,12 +135,73 @@ tests:
```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); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-97-large-non-mersenne-prime.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-97-large-non-mersenne-prime.english.md index dc37384fa0..32538d3057 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-97-large-non-mersenne-prime.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-97-large-non-mersenne-prime.english.md @@ -7,9 +7,13 @@ forumTopicId: 302214 ## 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 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. + Find the last ten digits of this prime number. +
## Instructions @@ -22,8 +26,10 @@ Find the last ten digits of this prime number. ```yml tests: - - text: euler97() should return 8739992577. - testString: assert.strictEqual(euler97(), 8739992577); + - text: lrgNonMersennePrime() should return a number. + testString: assert(typeof lrgNonMersennePrime() === 'number'); + - text: lrgNonMersennePrime() should return 8739992577. + testString: assert.strictEqual(lrgNonMersennePrime(), 8739992577); ``` @@ -35,12 +41,12 @@ tests:
```js -function euler97() { +function lrgNonMersennePrime() { // Good luck! return true; } -euler97(); +lrgNonMersennePrime(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-98-anagramic-squares.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-98-anagramic-squares.english.md index b9a9a41299..4de09c5a0d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-98-anagramic-squares.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-98-anagramic-squares.english.md @@ -7,10 +7,15 @@ forumTopicId: 302215 ## Description
-By replacing each of the letters in the word CARE with 1, 2, 9, and 6 respectively, we form a square number: 1296 = 362. What is remarkable is that, by using the same digital substitutions, the anagram, RACE, also forms a square number: 9216 = 962. We shall call CARE (and RACE) a square anagram word pair and specify further that leading zeroes are not permitted, neither may a different letter have the same digital value as another letter. -Using words.txt (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words, find all the square anagram word pairs (a palindromic word is NOT considered to be an anagram of itself). + +By replacing each of the letters in the word CARE with 1, 2, 9, and 6 respectively, we form a square number: 1296 = 362. What is remarkable is that, by using the same digital substitutions, the anagram, RACE, also forms a square number: 9216 = 962. We shall call CARE (and RACE) a square anagram word pair and specify further that leading zeroes are not permitted, neither may a different letter have the same digital value as another letter. + +Using the included array, find all the square anagram word pairs (a palindromic word is NOT considered to be an anagram of itself). + What is the largest square number formed by any member of such a pair? -NOTE: All anagrams formed must be contained in the given text file. + +**Note:** All anagrams formed must be contained in the given `words` array. +
## Instructions @@ -23,8 +28,10 @@ NOTE: All anagrams formed must be contained in the given text file. ```yml tests: - - text: euler98() should return 18769. - testString: assert.strictEqual(euler98(), 18769); + - text: anagramicSquares() should return a number. + testString: assert(typeof anagramicSquares() === 'number'); + - text: anagramicSquares() should return 18769. + testString: assert.strictEqual(anagramicSquares(), 18769); ``` @@ -36,12 +43,18 @@ tests:
```js -function euler98() { +function anagramicSquares() { // Good luck! return true; } -euler98(); +// Only change code above this line + +const words = [ + "A","ABILITY","ABLE","ABOUT","ABOVE","ABSENCE","ABSOLUTELY","ACADEMIC","ACCEPT","ACCESS","ACCIDENT","ACCOMPANY","ACCORDING","ACCOUNT","ACHIEVE","ACHIEVEMENT","ACID","ACQUIRE","ACROSS","ACT","ACTION","ACTIVE","ACTIVITY","ACTUAL","ACTUALLY","ADD","ADDITION","ADDITIONAL","ADDRESS","ADMINISTRATION","ADMIT","ADOPT","ADULT","ADVANCE","ADVANTAGE","ADVICE","ADVISE","AFFAIR","AFFECT","AFFORD","AFRAID","AFTER","AFTERNOON","AFTERWARDS","AGAIN","AGAINST","AGE","AGENCY","AGENT","AGO","AGREE","AGREEMENT","AHEAD","AID","AIM","AIR","AIRCRAFT","ALL","ALLOW","ALMOST","ALONE","ALONG","ALREADY","ALRIGHT","ALSO","ALTERNATIVE","ALTHOUGH","ALWAYS","AMONG","AMONGST","AMOUNT","AN","ANALYSIS","ANCIENT","AND","ANIMAL","ANNOUNCE","ANNUAL","ANOTHER","ANSWER","ANY","ANYBODY","ANYONE","ANYTHING","ANYWAY","APART","APPARENT","APPARENTLY","APPEAL","APPEAR","APPEARANCE","APPLICATION","APPLY","APPOINT","APPOINTMENT","APPROACH","APPROPRIATE","APPROVE","AREA","ARGUE","ARGUMENT","ARISE","ARM","ARMY","AROUND","ARRANGE","ARRANGEMENT","ARRIVE","ART","ARTICLE","ARTIST","AS","ASK","ASPECT","ASSEMBLY","ASSESS","ASSESSMENT","ASSET","ASSOCIATE","ASSOCIATION","ASSUME","ASSUMPTION","AT","ATMOSPHERE","ATTACH","ATTACK","ATTEMPT","ATTEND","ATTENTION","ATTITUDE","ATTRACT","ATTRACTIVE","AUDIENCE","AUTHOR","AUTHORITY","AVAILABLE","AVERAGE","AVOID","AWARD","AWARE","AWAY","AYE","BABY","BACK","BACKGROUND","BAD","BAG","BALANCE","BALL","BAND","BANK","BAR","BASE","BASIC","BASIS","BATTLE","BE","BEAR","BEAT","BEAUTIFUL","BECAUSE","BECOME","BED","BEDROOM","BEFORE","BEGIN","BEGINNING","BEHAVIOUR","BEHIND","BELIEF","BELIEVE","BELONG","BELOW","BENEATH","BENEFIT","BESIDE","BEST","BETTER","BETWEEN","BEYOND","BIG","BILL","BIND","BIRD","BIRTH","BIT","BLACK","BLOCK","BLOOD","BLOODY","BLOW","BLUE","BOARD","BOAT","BODY","BONE","BOOK","BORDER","BOTH","BOTTLE","BOTTOM","BOX","BOY","BRAIN","BRANCH","BREAK","BREATH","BRIDGE","BRIEF","BRIGHT","BRING","BROAD","BROTHER","BUDGET","BUILD","BUILDING","BURN","BUS","BUSINESS","BUSY","BUT","BUY","BY","CABINET","CALL","CAMPAIGN","CAN","CANDIDATE","CAPABLE","CAPACITY","CAPITAL","CAR","CARD","CARE","CAREER","CAREFUL","CAREFULLY","CARRY","CASE","CASH","CAT","CATCH","CATEGORY","CAUSE","CELL","CENTRAL","CENTRE","CENTURY","CERTAIN","CERTAINLY","CHAIN","CHAIR","CHAIRMAN","CHALLENGE","CHANCE","CHANGE","CHANNEL","CHAPTER","CHARACTER","CHARACTERISTIC","CHARGE","CHEAP","CHECK","CHEMICAL","CHIEF","CHILD","CHOICE","CHOOSE","CHURCH","CIRCLE","CIRCUMSTANCE","CITIZEN","CITY","CIVIL","CLAIM","CLASS","CLEAN","CLEAR","CLEARLY","CLIENT","CLIMB","CLOSE","CLOSELY","CLOTHES","CLUB","COAL","CODE","COFFEE","COLD","COLLEAGUE","COLLECT","COLLECTION","COLLEGE","COLOUR","COMBINATION","COMBINE","COME","COMMENT","COMMERCIAL","COMMISSION","COMMIT","COMMITMENT","COMMITTEE","COMMON","COMMUNICATION","COMMUNITY","COMPANY","COMPARE","COMPARISON","COMPETITION","COMPLETE","COMPLETELY","COMPLEX","COMPONENT","COMPUTER","CONCENTRATE","CONCENTRATION","CONCEPT","CONCERN","CONCERNED","CONCLUDE","CONCLUSION","CONDITION","CONDUCT","CONFERENCE","CONFIDENCE","CONFIRM","CONFLICT","CONGRESS","CONNECT","CONNECTION","CONSEQUENCE","CONSERVATIVE","CONSIDER","CONSIDERABLE","CONSIDERATION","CONSIST","CONSTANT","CONSTRUCTION","CONSUMER","CONTACT","CONTAIN","CONTENT","CONTEXT","CONTINUE","CONTRACT","CONTRAST","CONTRIBUTE","CONTRIBUTION","CONTROL","CONVENTION","CONVERSATION","COPY","CORNER","CORPORATE","CORRECT","COS","COST","COULD","COUNCIL","COUNT","COUNTRY","COUNTY","COUPLE","COURSE","COURT","COVER","CREATE","CREATION","CREDIT","CRIME","CRIMINAL","CRISIS","CRITERION","CRITICAL","CRITICISM","CROSS","CROWD","CRY","CULTURAL","CULTURE","CUP","CURRENT","CURRENTLY","CURRICULUM","CUSTOMER","CUT","DAMAGE","DANGER","DANGEROUS","DARK","DATA","DATE","DAUGHTER","DAY","DEAD","DEAL","DEATH","DEBATE","DEBT","DECADE","DECIDE","DECISION","DECLARE","DEEP","DEFENCE","DEFENDANT","DEFINE","DEFINITION","DEGREE","DELIVER","DEMAND","DEMOCRATIC","DEMONSTRATE","DENY","DEPARTMENT","DEPEND","DEPUTY","DERIVE","DESCRIBE","DESCRIPTION","DESIGN","DESIRE","DESK","DESPITE","DESTROY","DETAIL","DETAILED","DETERMINE","DEVELOP","DEVELOPMENT","DEVICE","DIE","DIFFERENCE","DIFFERENT","DIFFICULT","DIFFICULTY","DINNER","DIRECT","DIRECTION","DIRECTLY","DIRECTOR","DISAPPEAR","DISCIPLINE","DISCOVER","DISCUSS","DISCUSSION","DISEASE","DISPLAY","DISTANCE","DISTINCTION","DISTRIBUTION","DISTRICT","DIVIDE","DIVISION","DO","DOCTOR","DOCUMENT","DOG","DOMESTIC","DOOR","DOUBLE","DOUBT","DOWN","DRAW","DRAWING","DREAM","DRESS","DRINK","DRIVE","DRIVER","DROP","DRUG","DRY","DUE","DURING","DUTY","EACH","EAR","EARLY","EARN","EARTH","EASILY","EAST","EASY","EAT","ECONOMIC","ECONOMY","EDGE","EDITOR","EDUCATION","EDUCATIONAL","EFFECT","EFFECTIVE","EFFECTIVELY","EFFORT","EGG","EITHER","ELDERLY","ELECTION","ELEMENT","ELSE","ELSEWHERE","EMERGE","EMPHASIS","EMPLOY","EMPLOYEE","EMPLOYER","EMPLOYMENT","EMPTY","ENABLE","ENCOURAGE","END","ENEMY","ENERGY","ENGINE","ENGINEERING","ENJOY","ENOUGH","ENSURE","ENTER","ENTERPRISE","ENTIRE","ENTIRELY","ENTITLE","ENTRY","ENVIRONMENT","ENVIRONMENTAL","EQUAL","EQUALLY","EQUIPMENT","ERROR","ESCAPE","ESPECIALLY","ESSENTIAL","ESTABLISH","ESTABLISHMENT","ESTATE","ESTIMATE","EVEN","EVENING","EVENT","EVENTUALLY","EVER","EVERY","EVERYBODY","EVERYONE","EVERYTHING","EVIDENCE","EXACTLY","EXAMINATION","EXAMINE","EXAMPLE","EXCELLENT","EXCEPT","EXCHANGE","EXECUTIVE","EXERCISE","EXHIBITION","EXIST","EXISTENCE","EXISTING","EXPECT","EXPECTATION","EXPENDITURE","EXPENSE","EXPENSIVE","EXPERIENCE","EXPERIMENT","EXPERT","EXPLAIN","EXPLANATION","EXPLORE","EXPRESS","EXPRESSION","EXTEND","EXTENT","EXTERNAL","EXTRA","EXTREMELY","EYE","FACE","FACILITY","FACT","FACTOR","FACTORY","FAIL","FAILURE","FAIR","FAIRLY","FAITH","FALL","FAMILIAR","FAMILY","FAMOUS","FAR","FARM","FARMER","FASHION","FAST","FATHER","FAVOUR","FEAR","FEATURE","FEE","FEEL","FEELING","FEMALE","FEW","FIELD","FIGHT","FIGURE","FILE","FILL","FILM","FINAL","FINALLY","FINANCE","FINANCIAL","FIND","FINDING","FINE","FINGER","FINISH","FIRE","FIRM","FIRST","FISH","FIT","FIX","FLAT","FLIGHT","FLOOR","FLOW","FLOWER","FLY","FOCUS","FOLLOW","FOLLOWING","FOOD","FOOT","FOOTBALL","FOR","FORCE","FOREIGN","FOREST","FORGET","FORM","FORMAL","FORMER","FORWARD","FOUNDATION","FREE","FREEDOM","FREQUENTLY","FRESH","FRIEND","FROM","FRONT","FRUIT","FUEL","FULL","FULLY","FUNCTION","FUND","FUNNY","FURTHER","FUTURE","GAIN","GAME","GARDEN","GAS","GATE","GATHER","GENERAL","GENERALLY","GENERATE","GENERATION","GENTLEMAN","GET","GIRL","GIVE","GLASS","GO","GOAL","GOD","GOLD","GOOD","GOVERNMENT","GRANT","GREAT","GREEN","GREY","GROUND","GROUP","GROW","GROWING","GROWTH","GUEST","GUIDE","GUN","HAIR","HALF","HALL","HAND","HANDLE","HANG","HAPPEN","HAPPY","HARD","HARDLY","HATE","HAVE","HE","HEAD","HEALTH","HEAR","HEART","HEAT","HEAVY","HELL","HELP","HENCE","HER","HERE","HERSELF","HIDE","HIGH","HIGHLY","HILL","HIM","HIMSELF","HIS","HISTORICAL","HISTORY","HIT","HOLD","HOLE","HOLIDAY","HOME","HOPE","HORSE","HOSPITAL","HOT","HOTEL","HOUR","HOUSE","HOUSEHOLD","HOUSING","HOW","HOWEVER","HUGE","HUMAN","HURT","HUSBAND","I","IDEA","IDENTIFY","IF","IGNORE","ILLUSTRATE","IMAGE","IMAGINE","IMMEDIATE","IMMEDIATELY","IMPACT","IMPLICATION","IMPLY","IMPORTANCE","IMPORTANT","IMPOSE","IMPOSSIBLE","IMPRESSION","IMPROVE","IMPROVEMENT","IN","INCIDENT","INCLUDE","INCLUDING","INCOME","INCREASE","INCREASED","INCREASINGLY","INDEED","INDEPENDENT","INDEX","INDICATE","INDIVIDUAL","INDUSTRIAL","INDUSTRY","INFLUENCE","INFORM","INFORMATION","INITIAL","INITIATIVE","INJURY","INSIDE","INSIST","INSTANCE","INSTEAD","INSTITUTE","INSTITUTION","INSTRUCTION","INSTRUMENT","INSURANCE","INTEND","INTENTION","INTEREST","INTERESTED","INTERESTING","INTERNAL","INTERNATIONAL","INTERPRETATION","INTERVIEW","INTO","INTRODUCE","INTRODUCTION","INVESTIGATE","INVESTIGATION","INVESTMENT","INVITE","INVOLVE","IRON","IS","ISLAND","ISSUE","IT","ITEM","ITS","ITSELF","JOB","JOIN","JOINT","JOURNEY","JUDGE","JUMP","JUST","JUSTICE","KEEP","KEY","KID","KILL","KIND","KING","KITCHEN","KNEE","KNOW","KNOWLEDGE","LABOUR","LACK","LADY","LAND","LANGUAGE","LARGE","LARGELY","LAST","LATE","LATER","LATTER","LAUGH","LAUNCH","LAW","LAWYER","LAY","LEAD","LEADER","LEADERSHIP","LEADING","LEAF","LEAGUE","LEAN","LEARN","LEAST","LEAVE","LEFT","LEG","LEGAL","LEGISLATION","LENGTH","LESS","LET","LETTER","LEVEL","LIABILITY","LIBERAL","LIBRARY","LIE","LIFE","LIFT","LIGHT","LIKE","LIKELY","LIMIT","LIMITED","LINE","LINK","LIP","LIST","LISTEN","LITERATURE","LITTLE","LIVE","LIVING","LOAN","LOCAL","LOCATION","LONG","LOOK","LORD","LOSE","LOSS","LOT","LOVE","LOVELY","LOW","LUNCH","MACHINE","MAGAZINE","MAIN","MAINLY","MAINTAIN","MAJOR","MAJORITY","MAKE","MALE","MAN","MANAGE","MANAGEMENT","MANAGER","MANNER","MANY","MAP","MARK","MARKET","MARRIAGE","MARRIED","MARRY","MASS","MASTER","MATCH","MATERIAL","MATTER","MAY","MAYBE","ME","MEAL","MEAN","MEANING","MEANS","MEANWHILE","MEASURE","MECHANISM","MEDIA","MEDICAL","MEET","MEETING","MEMBER","MEMBERSHIP","MEMORY","MENTAL","MENTION","MERELY","MESSAGE","METAL","METHOD","MIDDLE","MIGHT","MILE","MILITARY","MILK","MIND","MINE","MINISTER","MINISTRY","MINUTE","MISS","MISTAKE","MODEL","MODERN","MODULE","MOMENT","MONEY","MONTH","MORE","MORNING","MOST","MOTHER","MOTION","MOTOR","MOUNTAIN","MOUTH","MOVE","MOVEMENT","MUCH","MURDER","MUSEUM","MUSIC","MUST","MY","MYSELF","NAME","NARROW","NATION","NATIONAL","NATURAL","NATURE","NEAR","NEARLY","NECESSARILY","NECESSARY","NECK","NEED","NEGOTIATION","NEIGHBOUR","NEITHER","NETWORK","NEVER","NEVERTHELESS","NEW","NEWS","NEWSPAPER","NEXT","NICE","NIGHT","NO","NOBODY","NOD","NOISE","NONE","NOR","NORMAL","NORMALLY","NORTH","NORTHERN","NOSE","NOT","NOTE","NOTHING","NOTICE","NOTION","NOW","NUCLEAR","NUMBER","NURSE","OBJECT","OBJECTIVE","OBSERVATION","OBSERVE","OBTAIN","OBVIOUS","OBVIOUSLY","OCCASION","OCCUR","ODD","OF","OFF","OFFENCE","OFFER","OFFICE","OFFICER","OFFICIAL","OFTEN","OIL","OKAY","OLD","ON","ONCE","ONE","ONLY","ONTO","OPEN","OPERATE","OPERATION","OPINION","OPPORTUNITY","OPPOSITION","OPTION","OR","ORDER","ORDINARY","ORGANISATION","ORGANISE","ORGANIZATION","ORIGIN","ORIGINAL","OTHER","OTHERWISE","OUGHT","OUR","OURSELVES","OUT","OUTCOME","OUTPUT","OUTSIDE","OVER","OVERALL","OWN","OWNER","PACKAGE","PAGE","PAIN","PAINT","PAINTING","PAIR","PANEL","PAPER","PARENT","PARK","PARLIAMENT","PART","PARTICULAR","PARTICULARLY","PARTLY","PARTNER","PARTY","PASS","PASSAGE","PAST","PATH","PATIENT","PATTERN","PAY","PAYMENT","PEACE","PENSION","PEOPLE","PER","PERCENT","PERFECT","PERFORM","PERFORMANCE","PERHAPS","PERIOD","PERMANENT","PERSON","PERSONAL","PERSUADE","PHASE","PHONE","PHOTOGRAPH","PHYSICAL","PICK","PICTURE","PIECE","PLACE","PLAN","PLANNING","PLANT","PLASTIC","PLATE","PLAY","PLAYER","PLEASE","PLEASURE","PLENTY","PLUS","POCKET","POINT","POLICE","POLICY","POLITICAL","POLITICS","POOL","POOR","POPULAR","POPULATION","POSITION","POSITIVE","POSSIBILITY","POSSIBLE","POSSIBLY","POST","POTENTIAL","POUND","POWER","POWERFUL","PRACTICAL","PRACTICE","PREFER","PREPARE","PRESENCE","PRESENT","PRESIDENT","PRESS","PRESSURE","PRETTY","PREVENT","PREVIOUS","PREVIOUSLY","PRICE","PRIMARY","PRIME","PRINCIPLE","PRIORITY","PRISON","PRISONER","PRIVATE","PROBABLY","PROBLEM","PROCEDURE","PROCESS","PRODUCE","PRODUCT","PRODUCTION","PROFESSIONAL","PROFIT","PROGRAM","PROGRAMME","PROGRESS","PROJECT","PROMISE","PROMOTE","PROPER","PROPERLY","PROPERTY","PROPORTION","PROPOSE","PROPOSAL","PROSPECT","PROTECT","PROTECTION","PROVE","PROVIDE","PROVIDED","PROVISION","PUB","PUBLIC","PUBLICATION","PUBLISH","PULL","PUPIL","PURPOSE","PUSH","PUT","QUALITY","QUARTER","QUESTION","QUICK","QUICKLY","QUIET","QUITE","RACE","RADIO","RAILWAY","RAIN","RAISE","RANGE","RAPIDLY","RARE","RATE","RATHER","REACH","REACTION","READ","READER","READING","READY","REAL","REALISE","REALITY","REALIZE","REALLY","REASON","REASONABLE","RECALL","RECEIVE","RECENT","RECENTLY","RECOGNISE","RECOGNITION","RECOGNIZE","RECOMMEND","RECORD","RECOVER","RED","REDUCE","REDUCTION","REFER","REFERENCE","REFLECT","REFORM","REFUSE","REGARD","REGION","REGIONAL","REGULAR","REGULATION","REJECT","RELATE","RELATION","RELATIONSHIP","RELATIVE","RELATIVELY","RELEASE","RELEVANT","RELIEF","RELIGION","RELIGIOUS","RELY","REMAIN","REMEMBER","REMIND","REMOVE","REPEAT","REPLACE","REPLY","REPORT","REPRESENT","REPRESENTATION","REPRESENTATIVE","REQUEST","REQUIRE","REQUIREMENT","RESEARCH","RESOURCE","RESPECT","RESPOND","RESPONSE","RESPONSIBILITY","RESPONSIBLE","REST","RESTAURANT","RESULT","RETAIN","RETURN","REVEAL","REVENUE","REVIEW","REVOLUTION","RICH","RIDE","RIGHT","RING","RISE","RISK","RIVER","ROAD","ROCK","ROLE","ROLL","ROOF","ROOM","ROUND","ROUTE","ROW","ROYAL","RULE","RUN","RURAL","SAFE","SAFETY","SALE","SAME","SAMPLE","SATISFY","SAVE","SAY","SCALE","SCENE","SCHEME","SCHOOL","SCIENCE","SCIENTIFIC","SCIENTIST","SCORE","SCREEN","SEA","SEARCH","SEASON","SEAT","SECOND","SECONDARY","SECRETARY","SECTION","SECTOR","SECURE","SECURITY","SEE","SEEK","SEEM","SELECT","SELECTION","SELL","SEND","SENIOR","SENSE","SENTENCE","SEPARATE","SEQUENCE","SERIES","SERIOUS","SERIOUSLY","SERVANT","SERVE","SERVICE","SESSION","SET","SETTLE","SETTLEMENT","SEVERAL","SEVERE","SEX","SEXUAL","SHAKE","SHALL","SHAPE","SHARE","SHE","SHEET","SHIP","SHOE","SHOOT","SHOP","SHORT","SHOT","SHOULD","SHOULDER","SHOUT","SHOW","SHUT","SIDE","SIGHT","SIGN","SIGNAL","SIGNIFICANCE","SIGNIFICANT","SILENCE","SIMILAR","SIMPLE","SIMPLY","SINCE","SING","SINGLE","SIR","SISTER","SIT","SITE","SITUATION","SIZE","SKILL","SKIN","SKY","SLEEP","SLIGHTLY","SLIP","SLOW","SLOWLY","SMALL","SMILE","SO","SOCIAL","SOCIETY","SOFT","SOFTWARE","SOIL","SOLDIER","SOLICITOR","SOLUTION","SOME","SOMEBODY","SOMEONE","SOMETHING","SOMETIMES","SOMEWHAT","SOMEWHERE","SON","SONG","SOON","SORRY","SORT","SOUND","SOURCE","SOUTH","SOUTHERN","SPACE","SPEAK","SPEAKER","SPECIAL","SPECIES","SPECIFIC","SPEECH","SPEED","SPEND","SPIRIT","SPORT","SPOT","SPREAD","SPRING","STAFF","STAGE","STAND","STANDARD","STAR","START","STATE","STATEMENT","STATION","STATUS","STAY","STEAL","STEP","STICK","STILL","STOCK","STONE","STOP","STORE","STORY","STRAIGHT","STRANGE","STRATEGY","STREET","STRENGTH","STRIKE","STRONG","STRONGLY","STRUCTURE","STUDENT","STUDIO","STUDY","STUFF","STYLE","SUBJECT","SUBSTANTIAL","SUCCEED","SUCCESS","SUCCESSFUL","SUCH","SUDDENLY","SUFFER","SUFFICIENT","SUGGEST","SUGGESTION","SUITABLE","SUM","SUMMER","SUN","SUPPLY","SUPPORT","SUPPOSE","SURE","SURELY","SURFACE","SURPRISE","SURROUND","SURVEY","SURVIVE","SWITCH","SYSTEM","TABLE","TAKE","TALK","TALL","TAPE","TARGET","TASK","TAX","TEA","TEACH","TEACHER","TEACHING","TEAM","TEAR","TECHNICAL","TECHNIQUE","TECHNOLOGY","TELEPHONE","TELEVISION","TELL","TEMPERATURE","TEND","TERM","TERMS","TERRIBLE","TEST","TEXT","THAN","THANK","THANKS","THAT","THE","THEATRE","THEIR","THEM","THEME","THEMSELVES","THEN","THEORY","THERE","THEREFORE","THESE","THEY","THIN","THING","THINK","THIS","THOSE","THOUGH","THOUGHT","THREAT","THREATEN","THROUGH","THROUGHOUT","THROW","THUS","TICKET","TIME","TINY","TITLE","TO","TODAY","TOGETHER","TOMORROW","TONE","TONIGHT","TOO","TOOL","TOOTH","TOP","TOTAL","TOTALLY","TOUCH","TOUR","TOWARDS","TOWN","TRACK","TRADE","TRADITION","TRADITIONAL","TRAFFIC","TRAIN","TRAINING","TRANSFER","TRANSPORT","TRAVEL","TREAT","TREATMENT","TREATY","TREE","TREND","TRIAL","TRIP","TROOP","TROUBLE","TRUE","TRUST","TRUTH","TRY","TURN","TWICE","TYPE","TYPICAL","UNABLE","UNDER","UNDERSTAND","UNDERSTANDING","UNDERTAKE","UNEMPLOYMENT","UNFORTUNATELY","UNION","UNIT","UNITED","UNIVERSITY","UNLESS","UNLIKELY","UNTIL","UP","UPON","UPPER","URBAN","US","USE","USED","USEFUL","USER","USUAL","USUALLY","VALUE","VARIATION","VARIETY","VARIOUS","VARY","VAST","VEHICLE","VERSION","VERY","VIA","VICTIM","VICTORY","VIDEO","VIEW","VILLAGE","VIOLENCE","VISION","VISIT","VISITOR","VITAL","VOICE","VOLUME","VOTE","WAGE","WAIT","WALK","WALL","WANT","WAR","WARM","WARN","WASH","WATCH","WATER","WAVE","WAY","WE","WEAK","WEAPON","WEAR","WEATHER","WEEK","WEEKEND","WEIGHT","WELCOME","WELFARE","WELL","WEST","WESTERN","WHAT","WHATEVER","WHEN","WHERE","WHEREAS","WHETHER","WHICH","WHILE","WHILST","WHITE","WHO","WHOLE","WHOM","WHOSE","WHY","WIDE","WIDELY","WIFE","WILD","WILL","WIN","WIND","WINDOW","WINE","WING","WINNER","WINTER","WISH","WITH","WITHDRAW","WITHIN","WITHOUT","WOMAN","WONDER","WONDERFUL","WOOD","WORD","WORK","WORKER","WORKING","WORKS","WORLD","WORRY","WORTH","WOULD","WRITE","WRITER","WRITING","WRONG","YARD","YEAH","YEAR","YES","YESTERDAY","YET","YOU","YOUNG","YOUR","YOURSELF","YOUTH" +]; + +anagramicSquares(); ```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-99-largest-exponential.english.md b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-99-largest-exponential.english.md index 0303ee2004..c13d973236 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-99-largest-exponential.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-99-largest-exponential.english.md @@ -7,10 +7,15 @@ forumTopicId: 302216 ## Description
-Comparing two numbers written in index form like 211 and 37 is not difficult, as any calculator would confirm that 211 = 2048 < 37 = 2187. -However, confirming that 632382518061 > 519432525806 would be much more difficult, as both numbers contain over three million digits. -Using base_exp.txt (right click and 'Save Link/Target As...'), a 22K text file containing one thousand lines with a base/exponent pair on each line, determine which line number has the greatest numerical value. -NOTE: The first two lines in the file represent the numbers in the example given above. + +Comparing two numbers written in index form like 211 and 37 is not difficult, as any calculator would confirm that 211 = 2048 < 37 = 2187. + +However, confirming that 632382518061 > 519432525806 would be much more difficult, as both numbers contain over three million digits. + +Using the included 2D array of base/exponent pairs, determine which pair has the greatest numerical value. + +**Note:** The first array in `baseExp` represent the numbers in the example given above. +
## Instructions @@ -23,8 +28,10 @@ NOTE: The first two lines in the file represent the numbers in the example given ```yml tests: - - text: euler99() should return 709. - testString: assert.strictEqual(euler99(), 709); + - text: largestExponential() should return a number. + testString: assert(typeof largestExponential() === 'number'); + - text: largestExponential() should return 709. + testString: assert.strictEqual(largestExponential(), 709); ``` @@ -36,12 +43,18 @@ tests:
```js -function euler99() { +function largestExponential() { // Good luck! return true; } -euler99(); +// Only change code above this line + +const baseExp = [ + [519432,525806],[632382,518061],[78864,613712],[466580,530130],[780495,510032],[525895,525320],[15991,714883],[960290,502358],[760018,511029],[166800,575487],[210884,564478],[555151,523163],[681146,515199],[563395,522587],[738250,512126],[923525,503780],[595148,520429],[177108,572629],[750923,511482],[440902,532446],[881418,505504],[422489,534197],[979858,501616],[685893,514935],[747477,511661],[167214,575367],[234140,559696],[940238,503122],[728969,512609],[232083,560102],[900971,504694],[688801,514772],[189664,569402],[891022,505104],[445689,531996],[119570,591871],[821453,508118],[371084,539600],[911745,504251],[623655,518600],[144361,582486],[352442,541775],[420726,534367],[295298,549387],[6530,787777],[468397,529976],[672336,515696],[431861,533289],[84228,610150],[805376,508857],[444409,532117],[33833,663511],[381850,538396],[402931,536157],[92901,604930],[304825,548004],[731917,512452],[753734,511344],[51894,637373],[151578,580103],[295075,549421],[303590,548183],[333594,544123],[683952,515042],[60090,628880],[951420,502692],[28335,674991],[714940,513349],[343858,542826],[549279,523586],[804571,508887],[260653,554881],[291399,549966],[402342,536213],[408889,535550],[40328,652524],[375856,539061],[768907,510590],[165993,575715],[976327,501755],[898500,504795],[360404,540830],[478714,529095],[694144,514472],[488726,528258],[841380,507226],[328012,544839],[22389,690868],[604053,519852],[329514,544641],[772965,510390],[492798,527927],[30125,670983],[895603,504906],[450785,531539],[840237,507276],[380711,538522],[63577,625673],[76801,615157],[502694,527123],[597706,520257],[310484,547206],[944468,502959],[121283,591152],[451131,531507],[566499,522367],[425373,533918],[40240,652665],[39130,654392],[714926,513355],[469219,529903],[806929,508783],[287970,550487],[92189,605332],[103841,599094],[671839,515725],[452048,531421],[987837,501323],[935192,503321],[88585,607450],[613883,519216],[144551,582413],[647359,517155],[213902,563816],[184120,570789],[258126,555322],[502546,527130],[407655,535678],[401528,536306],[477490,529193],[841085,507237],[732831,512408],[833000,507595],[904694,504542],[581435,521348],[455545,531110],[873558,505829],[94916,603796],[720176,513068],[545034,523891],[246348,557409],[556452,523079],[832015,507634],[173663,573564],[502634,527125],[250732,556611],[569786,522139],[216919,563178],[521815,525623],[92304,605270],[164446,576167],[753413,511364],[11410,740712],[448845,531712],[925072,503725],[564888,522477],[7062,780812],[641155,517535],[738878,512100],[636204,517828],[372540,539436],[443162,532237],[571192,522042],[655350,516680],[299741,548735],[581914,521307],[965471,502156],[513441,526277],[808682,508700],[237589,559034],[543300,524025],[804712,508889],[247511,557192],[543486,524008],[504383,526992],[326529,545039],[792493,509458],[86033,609017],[126554,589005],[579379,521481],[948026,502823],[404777,535969],[265767,554022],[266876,553840],[46631,643714],[492397,527958],[856106,506581],[795757,509305],[748946,511584],[294694,549480],[409781,535463],[775887,510253],[543747,523991],[210592,564536],[517119,525990],[520253,525751],[247926,557124],[592141,520626],[346580,542492],[544969,523902],[506501,526817],[244520,557738],[144745,582349],[69274,620858],[292620,549784],[926027,503687],[736320,512225],[515528,526113],[407549,535688],[848089,506927],[24141,685711],[9224,757964],[980684,501586],[175259,573121],[489160,528216],[878970,505604],[969546,502002],[525207,525365],[690461,514675],[156510,578551],[659778,516426],[468739,529945],[765252,510770],[76703,615230],[165151,575959],[29779,671736],[928865,503569],[577538,521605],[927555,503618],[185377,570477],[974756,501809],[800130,509093],[217016,563153],[365709,540216],[774508,510320],[588716,520851],[631673,518104],[954076,502590],[777828,510161],[990659,501222],[597799,520254],[786905,509727],[512547,526348],[756449,511212],[869787,505988],[653747,516779],[84623,609900],[839698,507295],[30159,670909],[797275,509234],[678136,515373],[897144,504851],[989554,501263],[413292,535106],[55297,633667],[788650,509637],[486748,528417],[150724,580377],[56434,632490],[77207,614869],[588631,520859],[611619,519367],[100006,601055],[528924,525093],[190225,569257],[851155,506789],[682593,515114],[613043,519275],[514673,526183],[877634,505655],[878905,505602],[1926,914951],[613245,519259],[152481,579816],[841774,507203],[71060,619442],[865335,506175],[90244,606469],[302156,548388],[399059,536557],[478465,529113],[558601,522925],[69132,620966],[267663,553700],[988276,501310],[378354,538787],[529909,525014],[161733,576968],[758541,511109],[823425,508024],[149821,580667],[269258,553438],[481152,528891],[120871,591322],[972322,501901],[981350,501567],[676129,515483],[950860,502717],[119000,592114],[392252,537272],[191618,568919],[946699,502874],[289555,550247],[799322,509139],[703886,513942],[194812,568143],[261823,554685],[203052,566221],[217330,563093],[734748,512313],[391759,537328],[807052,508777],[564467,522510],[59186,629748],[113447,594545],[518063,525916],[905944,504492],[613922,519213],[439093,532607],[445946,531981],[230530,560399],[297887,549007],[459029,530797],[403692,536075],[855118,506616],[963127,502245],[841711,507208],[407411,535699],[924729,503735],[914823,504132],[333725,544101],[176345,572832],[912507,504225],[411273,535308],[259774,555036],[632853,518038],[119723,591801],[163902,576321],[22691,689944],[402427,536212],[175769,572988],[837260,507402],[603432,519893],[313679,546767],[538165,524394],[549026,523608],[61083,627945],[898345,504798],[992556,501153],[369999,539727],[32847,665404],[891292,505088],[152715,579732],[824104,507997],[234057,559711],[730507,512532],[960529,502340],[388395,537687],[958170,502437],[57105,631806],[186025,570311],[993043,501133],[576770,521664],[215319,563513],[927342,503628],[521353,525666],[39563,653705],[752516,511408],[110755,595770],[309749,547305],[374379,539224],[919184,503952],[990652,501226],[647780,517135],[187177,570017],[168938,574877],[649558,517023],[278126,552016],[162039,576868],[658512,516499],[498115,527486],[896583,504868],[561170,522740],[747772,511647],[775093,510294],[652081,516882],[724905,512824],[499707,527365],[47388,642755],[646668,517204],[571700,522007],[180430,571747],[710015,513617],[435522,532941],[98137,602041],[759176,511070],[486124,528467],[526942,525236],[878921,505604],[408313,535602],[926980,503640],[882353,505459],[566887,522345],[3326,853312],[911981,504248],[416309,534800],[392991,537199],[622829,518651],[148647,581055],[496483,527624],[666314,516044],[48562,641293],[672618,515684],[443676,532187],[274065,552661],[265386,554079],[347668,542358],[31816,667448],[181575,571446],[961289,502320],[365689,540214],[987950,501317],[932299,503440],[27388,677243],[746701,511701],[492258,527969],[147823,581323],[57918,630985],[838849,507333],[678038,515375],[27852,676130],[850241,506828],[818403,508253],[131717,587014],[850216,506834],[904848,504529],[189758,569380],[392845,537217],[470876,529761],[925353,503711],[285431,550877],[454098,531234],[823910,508003],[318493,546112],[766067,510730],[261277,554775],[421530,534289],[694130,514478],[120439,591498],[213308,563949],[854063,506662],[365255,540263],[165437,575872],[662240,516281],[289970,550181],[847977,506933],[546083,523816],[413252,535113],[975829,501767],[361540,540701],[235522,559435],[224643,561577],[736350,512229],[328303,544808],[35022,661330],[307838,547578],[474366,529458],[873755,505819],[73978,617220],[827387,507845],[670830,515791],[326511,545034],[309909,547285],[400970,536363],[884827,505352],[718307,513175],[28462,674699],[599384,520150],[253565,556111],[284009,551093],[343403,542876],[446557,531921],[992372,501160],[961601,502308],[696629,514342],[919537,503945],[894709,504944],[892201,505051],[358160,541097],[448503,531745],[832156,507636],[920045,503924],[926137,503675],[416754,534757],[254422,555966],[92498,605151],[826833,507873],[660716,516371],[689335,514746],[160045,577467],[814642,508425],[969939,501993],[242856,558047],[76302,615517],[472083,529653],[587101,520964],[99066,601543],[498005,527503],[709800,513624],[708000,513716],[20171,698134],[285020,550936],[266564,553891],[981563,501557],[846502,506991],[334,1190800],[209268,564829],[9844,752610],[996519,501007],[410059,535426],[432931,533188],[848012,506929],[966803,502110],[983434,501486],[160700,577267],[504374,526989],[832061,507640],[392825,537214],[443842,532165],[440352,532492],[745125,511776],[13718,726392],[661753,516312],[70500,619875],[436952,532814],[424724,533973],[21954,692224],[262490,554567],[716622,513264],[907584,504425],[60086,628882],[837123,507412],[971345,501940],[947162,502855],[139920,584021],[68330,621624],[666452,516038],[731446,512481],[953350,502619],[183157,571042],[845400,507045],[651548,516910],[20399,697344],[861779,506331],[629771,518229],[801706,509026],[189207,569512],[737501,512168],[719272,513115],[479285,529045],[136046,585401],[896746,504860],[891735,505067],[684771,514999],[865309,506184],[379066,538702],[503117,527090],[621780,518717],[209518,564775],[677135,515423],[987500,501340],[197049,567613],[329315,544673],[236756,559196],[357092,541226],[520440,525733],[213471,563911],[956852,502490],[702223,514032],[404943,535955],[178880,572152],[689477,514734],[691351,514630],[866669,506128],[370561,539656],[739805,512051],[71060,619441],[624861,518534],[261660,554714],[366137,540160],[166054,575698],[601878,519990],[153445,579501],[279899,551729],[379166,538691],[423209,534125],[675310,515526],[145641,582050],[691353,514627],[917468,504026],[284778,550976],[81040,612235],[161699,576978],[616394,519057],[767490,510661],[156896,578431],[427408,533714],[254849,555884],[737217,512182],[897133,504851],[203815,566051],[270822,553189],[135854,585475],[778805,510111],[784373,509847],[305426,547921],[733418,512375],[732087,512448],[540668,524215],[702898,513996],[628057,518328],[640280,517587],[422405,534204],[10604,746569],[746038,511733],[839808,507293],[457417,530938],[479030,529064],[341758,543090],[620223,518824],[251661,556451],[561790,522696],[497733,527521],[724201,512863],[489217,528217],[415623,534867],[624610,518548],[847541,506953],[432295,533249],[400391,536421],[961158,502319],[139173,584284],[421225,534315],[579083,521501],[74274,617000],[701142,514087],[374465,539219],[217814,562985],[358972,540995],[88629,607424],[288597,550389],[285819,550812],[538400,524385],[809930,508645],[738326,512126],[955461,502535],[163829,576343],[826475,507891],[376488,538987],[102234,599905],[114650,594002],[52815,636341],[434037,533082],[804744,508880],[98385,601905],[856620,506559],[220057,562517],[844734,507078],[150677,580387],[558697,522917],[621751,518719],[207067,565321],[135297,585677],[932968,503404],[604456,519822],[579728,521462],[244138,557813],[706487,513800],[711627,513523],[853833,506674],[497220,527562],[59428,629511],[564845,522486],[623621,518603],[242689,558077],[125091,589591],[363819,540432],[686453,514901],[656813,516594],[489901,528155],[386380,537905],[542819,524052],[243987,557841],[693412,514514],[488484,528271],[896331,504881],[336730,543721],[728298,512647],[604215,519840],[153729,579413],[595687,520398],[540360,524240],[245779,557511],[924873,503730],[509628,526577],[528523,525122],[3509,847707],[522756,525555],[895447,504922],[44840,646067],[45860,644715],[463487,530404],[398164,536654],[894483,504959],[619415,518874],[966306,502129],[990922,501212],[835756,507474],[548881,523618],[453578,531282],[474993,529410],[80085,612879],[737091,512193],[50789,638638],[979768,501620],[792018,509483],[665001,516122],[86552,608694],[462772,530469],[589233,520821],[891694,505072],[592605,520594],[209645,564741],[42531,649269],[554376,523226],[803814,508929],[334157,544042],[175836,572970],[868379,506051],[658166,516520],[278203,551995],[966198,502126],[627162,518387],[296774,549165],[311803,547027],[843797,507118],[702304,514032],[563875,522553],[33103,664910],[191932,568841],[543514,524006],[506835,526794],[868368,506052],[847025,506971],[678623,515342],[876139,505726],[571997,521984],[598632,520198],[213590,563892],[625404,518497],[726508,512738],[689426,514738],[332495,544264],[411366,535302],[242546,558110],[315209,546555],[797544,509219],[93889,604371],[858879,506454],[124906,589666],[449072,531693],[235960,559345],[642403,517454],[720567,513047],[705534,513858],[603692,519870],[488137,528302],[157370,578285],[63515,625730],[666326,516041],[619226,518883],[443613,532186],[597717,520257],[96225,603069],[86940,608450],[40725,651929],[460976,530625],[268875,553508],[270671,553214],[363254,540500],[384248,538137],[762889,510892],[377941,538833],[278878,551890],[176615,572755],[860008,506412],[944392,502967],[608395,519571],[225283,561450],[45095,645728],[333798,544090],[625733,518476],[995584,501037],[506135,526853],[238050,558952],[557943,522972],[530978,524938],[634244,517949],[177168,572616],[85200,609541],[953043,502630],[523661,525484],[999295,500902],[840803,507246],[961490,502312],[471747,529685],[380705,538523],[911180,504275],[334149,544046],[478992,529065],[325789,545133],[335884,543826],[426976,533760],[749007,511582],[667067,516000],[607586,519623],[674054,515599],[188534,569675],[565185,522464],[172090,573988],[87592,608052],[907432,504424],[8912,760841],[928318,503590],[757917,511138],[718693,513153],[315141,546566],[728326,512645],[353492,541647],[638429,517695],[628892,518280],[877286,505672],[620895,518778],[385878,537959],[423311,534113],[633501,517997],[884833,505360],[883402,505416],[999665,500894],[708395,513697],[548142,523667],[756491,511205],[987352,501340],[766520,510705],[591775,520647],[833758,507563],[843890,507108],[925551,503698],[74816,616598],[646942,517187],[354923,541481],[256291,555638],[634470,517942],[930904,503494],[134221,586071],[282663,551304],[986070,501394],[123636,590176],[123678,590164],[481717,528841],[423076,534137],[866246,506145],[93313,604697],[783632,509880],[317066,546304],[502977,527103],[141272,583545],[71708,618938],[617748,518975],[581190,521362],[193824,568382],[682368,515131],[352956,541712],[351375,541905],[505362,526909],[905165,504518],[128645,588188],[267143,553787],[158409,577965],[482776,528754],[628896,518282],[485233,528547],[563606,522574],[111001,595655],[115920,593445],[365510,540237],[959724,502374],[938763,503184],[930044,503520],[970959,501956],[913658,504176],[68117,621790],[989729,501253],[567697,522288],[820427,508163],[54236,634794],[291557,549938],[124961,589646],[403177,536130],[405421,535899],[410233,535417],[815111,508403],[213176,563974],[83099,610879],[998588,500934],[513640,526263],[129817,587733],[1820,921851],[287584,550539],[299160,548820],[860621,506386],[529258,525059],[586297,521017],[953406,502616],[441234,532410],[986217,501386],[781938,509957],[461247,530595],[735424,512277],[146623,581722],[839838,507288],[510667,526494],[935085,503327],[737523,512167],[303455,548204],[992779,501145],[60240,628739],[939095,503174],[794368,509370],[501825,527189],[459028,530798],[884641,505363],[512287,526364],[835165,507499],[307723,547590],[160587,577304],[735043,512300],[493289,527887],[110717,595785],[306480,547772],[318593,546089],[179810,571911],[200531,566799],[314999,546580],[197020,567622],[301465,548487],[237808,559000],[131944,586923],[882527,505449],[468117,530003],[711319,513541],[156240,578628],[965452,502162],[992756,501148],[437959,532715],[739938,512046],[614249,519196],[391496,537356],[62746,626418],[688215,514806],[75501,616091],[883573,505412],[558824,522910],[759371,511061],[173913,573489],[891351,505089],[727464,512693],[164833,576051],[812317,508529],[540320,524243],[698061,514257],[69149,620952],[471673,529694],[159092,577753],[428134,533653],[89997,606608],[711061,513557],[779403,510081],[203327,566155],[798176,509187],[667688,515963],[636120,517833],[137410,584913],[217615,563034],[556887,523038],[667229,515991],[672276,515708],[325361,545187],[172115,573985],[13846,725685] +]; + +largestExponential(); ```