Learning F#

Project Euler – Problem 71 Solution

Problem Consider the fraction, n/d, where n and d are positive integers. If n < d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d <= 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, …

Project Euler – Problem 71 Solution Read More »

Project Euler – Problem 59 Solution

Problem 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 …

Project Euler – Problem 59 Solution Read More »

Project Euler – Problem 79 Solution

Problem 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 …

Project Euler – Problem 79 Solution Read More »

Project Euler – Problem 145 Solution

Problem Some positive integers n have the property that the sum [ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbersreversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either …

Project Euler – Problem 145 Solution Read More »

Project Euler – Problem 205 Solution

Problem Peter has nine four-sided (pyramidal) dice, each with faces numbered 1, 2, 3, 4. Colin has six six-sided (cubic) dice, each with faces numbered 1, 2, 3, 4, 5, 6. Peter and Colin roll their dice and compare totals: the highest total wins. The result is a draw if the totals are equal. What …

Project Euler – Problem 205 Solution Read More »

Project Euler – Problem 85

Problem By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles: Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution. Solution This problem looks more difficult than it is, I’m not going to go …

Project Euler – Problem 85 Read More »

Project Euler – Problem 81 Solution

Problem 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. Find the minimal path sum, in matrix.txt (right click and ‘Save Link/Target As…’), a 31K text file …

Project Euler – Problem 81 Solution Read More »

Project Euler – Problem 99 Solution

Problem 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…’), …

Project Euler – Problem 99 Solution Read More »

Project Euler – Problem 54 Solution

Problem 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 …

Project Euler – Problem 54 Solution Read 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.

Close