# Learning F#

## Project Euler — Problem 89 Solution

Prob­lem The rules for writ­ing Roman numer­als allow for many ways of writ­ing each num­ber (see FAQ:Roman Numer­als). How­ev­er, there is always a “best” way of writ­ing a par­tic­u­lar num­ber. For exam­ple, the fol­low­ing rep­re­sent all of the legit­i­mate ways of writ­ing the num­ber six­teen: IIIIIIIIIIIIIIII VIIIIIIIIIII VVIIIIII XIIIIII VVVI XVI The last exam­ple being …

## Project Euler — Problem 66 Solution

Prob­lem Con­sid­er qua­drat­ic Dio­phan­tine equa­tions of the form: x2 – Dy2 = 1 For exam­ple, when D=13, the min­i­mal solu­tion in x is 6492 – 13x1802 = 1. It can be assumed that there are no solu­tions in pos­i­tive inte­gers when D is square. By find­ing min­i­mal solu­tions in x for D = {2, 3, …

## Project Euler — Problem 78 Solution

Prob­lem Let p(n) rep­re­sent the num­ber of dif­fer­ent ways in which n coins can be sep­a­rat­ed into piles. For exam­ple, five coins can sep­a­rat­ed into piles in exact­ly sev­en dif­fer­ent ways, so p(5)=7. OOOOO OOOO   O OOO   OO OOO   O   O OO   OO   O OO   O   O   O O   O   O   O   O Find the …

## Project Euler — Problem 77 Solution

Prob­lem It is pos­si­ble to write ten as the sum of primes in exact­ly five dif­fer­ent ways: 7 + 3 5 + 5 5 + 3 + 2 3 + 3 + 2 + 2 2 + 2 + 2 + 2 + 2 What is the first val­ue which can be writ­ten as the …

## Project Euler — Problem 76 Solution

Prob­lem It is pos­si­ble to write five as a sum in exact­ly six dif­fer­ent ways: 4 + 1 3 + 2 3 + 1 + 1 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 How many dif­fer­ent ways can one hun­dred be …

## Project Euler — Problem 63 Solution

Prob­lem The 5-dig­it num­ber, 16807=75, is also a fifth pow­er. Sim­i­lar­ly, the 9-dig­it num­ber, 134217728=89, is a ninth pow­er. How many n-dig­it pos­i­tive inte­gers exist which are also an nth pow­er? Solu­tion

## Project Euler — Problem 62 Solution

Prob­lem The cube, 41063625 (3453), can be per­mut­ed to pro­duce two oth­er cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the small­est cube which has exact­ly three per­mu­ta­tions of its dig­its which are also cube. Find the small­est cube for which exact­ly five per­mu­ta­tions of its dig­its are cube. Solu­tion

## Project Euler — Problem 112 Solution

Prob­lem Work­ing from left-to-right if no dig­it is exceed­ed by the dig­it to its left it is called an increas­ing num­ber; for exam­ple, 134468. Sim­i­lar­ly if no dig­it is exceed­ed by the dig­it to its right it is called a decreas­ing num­ber; for exam­ple, 66420. We shall call a pos­i­tive inte­ger that is nei­ther increas­ing …

## Project Euler — Problem 51 Solution

Prob­lem By replac­ing the 1st dig­it of *3, it turns out that six of the nine pos­si­ble val­ues: 13, 23, 43, 53, 73, and 83, are all prime. By replac­ing the 3rd and 4th dig­its of 56**3 with the same dig­it, this 5-dig­it num­ber is the first exam­ple hav­ing sev­en primes among the ten gen­er­at­ed …

## Project Euler — Problem 39 Solution

Prob­lem If p is the perime­ter of a right angle tri­an­gle with inte­gral length sides, {a,b,c}, there are exact­ly three solu­tions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which val­ue of p <= 1000, is the num­ber of solu­tions max­imised? Solu­tion