Project Euler Solutions

Project Euler — Problem 83 Solution

The prob­lem descrip­tion is here, and click here to see all my oth­er Euler solu­tions in F#.   This is a more dif­fi­cult ver­sion of prob­lem 82, and now you can move in all four direc­tions! As before, we start by load­ing the input data into a 2D array: and ini­tial­ize anoth­er matrix of the same …

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

Project Euler — Problem 82 Solution

The prob­lem descrip­tion is here, and click here to see all my oth­er Euler solu­tions in F#.   This is a more dif­fi­cult ver­sion of prob­lem 81, but still, as you can’t move left so we can still opti­mize one col­umn at a time. First, let’s read the input file into a 2D array: and …

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

Project Euler — Problem 102 Solution

The prob­lem descrip­tion is here, and click here to see all my oth­er Euler solu­tions in F#.   After read­ing the ques­tion, a quick search on how to test if a point is in a tri­an­gle turned up this use­ful SO answer. Trans­lat­ing the algo­rithm to F# is pret­ty triv­ial: I saved the triangle.txt file …

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

Project Euler — Problem 75 Solution

The prob­lem descrip­tion is here, and click here to see all my oth­er Euler solu­tions in F#.   I based my solu­tion on Euclid’s for­mu­la for gen­er­at­ing Pythagore­an triples. And giv­en that max L is 1,500,000, the max­i­mum val­ue for m we need to con­sid­er is . Because and , we can deduce that ; and since we …

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

Project Euler – Problem 68 Solution

Prob­lem Con­sid­er the fol­low­ing “mag­ic” 3-gon ring, filled with the num­bers 1 to 6, and each line adding to nine. Work­ing clock­wise, and start­ing from the group of three with the numer­i­cal­ly low­est exter­nal node (4,3,2 in this exam­ple), each solu­tion can be described unique­ly. For exam­ple, the above solu­tion can be described by the …

Project Euler – Prob­lem 68 Solu­tionRead More »

Project Euler – Problem 64 Solution

Prob­lem All square roots are peri­od­ic when writ­ten as con­tin­ued frac­tions and can be writ­ten in the form: For exam­ple, let us con­sid­er ?23: If we con­tin­ue we would get the fol­low­ing expan­sion: The process can be sum­marised as fol­lows: It can be seen that the sequence is repeat­ing. For con­cise­ness, we use the nota­tion …

Project Euler – Prob­lem 64 Solu­tionRead More »

Project Euler – Problem 80 Solution

Prob­lem It is well known that if the square root of a nat­ur­al num­ber is not an inte­ger, then it is irra­tional. The dec­i­mal expan­sion of such square roots is infi­nite with­out any repeat­ing pat­tern at all. The square root of two is 1.41421356237309504880…, and the dig­i­tal sum of the first one hun­dred dec­i­mal dig­its …

Project Euler – Prob­lem 80 Solu­tionRead More »

Project Euler – Problem 61 Solution

Prob­lem Tri­an­gle, square, pen­tag­o­nal, hexag­o­nal, hep­tag­o­nal, and octag­o­nal num­bers are all fig­u­rate (polyg­o­nal) num­bers and are gen­er­at­ed by the fol­low­ing for­mu­lae: The ordered set of three 4-dig­it num­bers: 8128, 2882, 8281, has three inter­est­ing prop­er­ties. The set is cyclic, in that the last two dig­its of each num­ber is the first two dig­its of the …

Project Euler – Prob­lem 61 Solu­tionRead More »

Project Euler — Problem 65 Solution

Prob­lem The square root of 2 can be writ­ten as an infi­nite con­tin­ued frac­tion. The infi­nite con­tin­ued frac­tion can be writ­ten, ?2 = [1;(2)], (2) indi­cates that 2 repeats ad infini­tum. In a sim­i­lar way, ?23 = [4;(1,3,1,8)]. It turns out that the sequence of par­tial val­ues of con­tin­ued frac­tions for square roots pro­vide the …

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

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 »

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