Learning F#

Project Euler — Problem 71 Solution

Prob­lem Con­sid­er the frac­tion, n/d, where n and d are pos­i­tive inte­gers. If n < d and HCF(n,d)=1, it is called a reduced prop­er frac­tion. If we list the set of reduced prop­er frac­tions for d <= 8 in ascend­ing 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, …

Project Euler — Prob­lem 71 Solu­tionRead More »

Project Euler — Problem 59 Solution

Prob­lem Each char­ac­ter on a com­put­er is assigned a unique code and the pre­ferred stan­dard is ASCII (Amer­i­can Stan­dard Code for Infor­ma­tion Inter­change). For exam­ple, upper­case A = 65, aster­isk (*) = 42, and low­er­case k = 107. A mod­ern encryp­tion method is to take a text file, con­vert the bytes to ASCII, then XOR …

Project Euler — Prob­lem 59 Solu­tionRead More »

Project Euler — Problem 79 Solution

Prob­lem A com­mon secu­ri­ty method used for online bank­ing is to ask the user for three ran­dom char­ac­ters from a pass­code. For exam­ple, if the pass­code was 531278, they may ask for the 2nd, 3rd, and 5th char­ac­ters; the expect­ed reply would be: 317. The text file, keylog.txt, con­tains fifty suc­cess­ful login attempts. Giv­en that …

Project Euler — Prob­lem 79 Solu­tionRead More »

Project Euler — Problem 145 Solution

Prob­lem Some pos­i­tive inte­gers n have the prop­er­ty that the sum [ n + reverse(n) ] con­sists entire­ly of odd (dec­i­mal) dig­its. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such num­ber­sre­versible; so 36, 63, 409, and 904 are reversible. Lead­ing zeroes are not allowed in either …

Project Euler — Prob­lem 145 Solu­tionRead More »

Project Euler — Problem 74 Solution

Prob­lem The num­ber 145 is well known for the prop­er­ty that the sum of the fac­to­r­i­al of its dig­its is equal to 145: 1! + 4! + 5! = 1 + 24 + 120 = 145 Per­haps less well known is 169, in that it pro­duces the longest chain of num­bers that link back to …

Project Euler — Prob­lem 74 Solu­tionRead More »

Project Euler — Problem 205 Solution

Prob­lem Peter has nine four-sided (pyra­mi­dal) dice, each with faces num­bered 1, 2, 3, 4. Col­in has six six-sided (cubic) dice, each with faces num­bered 1, 2, 3, 4, 5, 6. Peter and Col­in roll their dice and com­pare totals: the high­est total wins. The result is a draw if the totals are equal. What …

Project Euler — Prob­lem 205 Solu­tionRead More »

Project Euler — Problem 85

Prob­lem By count­ing care­ful­ly it can be seen that a rec­tan­gu­lar grid mea­sur­ing 3 by 2 con­tains eigh­teen rec­tan­gles: Although there exists no rec­tan­gu­lar grid that con­tains exact­ly two mil­lion rec­tan­gles, find the area of the grid with the near­est solu­tion. Solu­tion This prob­lem looks more dif­fi­cult than it is, I’m not going to go …

Project Euler — Prob­lem 85Read More »

Project Euler — Problem 81 Solution

Prob­lem In the 5 by 5 matrix below, the min­i­mal path sum from the top left to the bot­tom right, by only mov­ing to the right and down, is indi­cat­ed in bold red and is equal to 2427. Find the min­i­mal path sum, in matrix.txt (right click and ‘Save Link/Target As…’), a 31K text file …

Project Euler — Prob­lem 81 Solu­tionRead More »

Project Euler — Problem 99 Solution

Prob­lem Com­par­ing two num­bers writ­ten in index form like 211 and 37 is not dif­fi­cult, as any cal­cu­la­tor would con­firm that 211 = 2048 < 37 = 2187. How­ev­er, con­firm­ing that 632382518061 > 519432525806 would be much more dif­fi­cult, as both num­bers con­tain over three mil­lion dig­its. Using base_exp.txt (right click and ‘Save Link/Target As…’), …

Project Euler — Prob­lem 99 Solu­tionRead More »

Project Euler — Problem 54 Solution

Prob­lem In the card game pok­er, a hand con­sists of five cards and are ranked, from low­est to high­est, in the fol­low­ing way: High Card: High­est val­ue card. One Pair: Two cards of the same val­ue. Two Pairs: Two dif­fer­ent pairs. Three of a Kind: Three cards of the same val­ue. Straight: All cards are …

Project Euler — Prob­lem 54 Solu­tionRead More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.