## Snippets tagged puzzles

• ### Euler #5

Euler #5 solution

4 people like this

Posted: 12 years ago by Michael Falanga

• ### Project Euler Problem 19

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

3 people like this

Posted: 12 years ago by Gene Belitski

• ### How many words can you spell on a calculator?

We all know about BOOBIES - but how many other dictionary words can you spell upside-down on a calculator?

2 people like this

Posted: 12 years ago by Kit Eason

• ### functional fizz buzz

Recently witnessed a C# programmer struggle with the fizz buzz interview question. But it is straightforward in F# using pattern matching on the two-factor decision table.

3 people like this

Posted: 10 years ago by Alan Wostenberg

• ### Two Logicians

Solves the "Two Logicians" puzzle.

3 people like this

Posted: 9 years ago by Vandroiy

• ### Calculating when the 1000th XKCD will appear

Calculate's when a the nth XKCD will appear, starting from XKCD 946. For a full explanation this snippet see: http://strangelights.com/blog/archive/2011/09/02/calculating-when-the-1000th-xkcd-will-appear.aspx

3 people like this

Posted: 12 years ago by Robert Pickering

• ### Project Euler Problem 31

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). It is possible to make £2 in the following way: 1x£1 + 1x50p + 2x20p + 1x5p + 1x2p + 3x1p How many different ways can £2 be made using any number of coins?

3 people like this

Posted: 12 years ago by Gene Belitski

• ### Largest palindrome made from the product of two n-digit numbers

A generalised version of the solution to the fourth Project Euler problem - Largest palindrome product, using sequences. The key to understanding this code is how "Seq.map (fun x -> (Seq.map (fun y -> x * y) baseSeq)) baseSeq" generates a sequence of sequences that contains the products of all possible combinations of two n-digit numbers. "Seq.map (fun x -> (Seq.map (fun y -> x * y) {1..3})) {1..3}" will generate: seq [seq [1; 2; 3]; seq [2; 4; 6]; seq [3; 6; 9]]

3 people like this

Posted: 11 years ago by Bjørn Bæverfjord

• ### Missionaries and Cannibals Problem and its state space tree

Generating a state space tree to the Missionaries and Cannibals Problem (http://en.wikipedia.org/wiki/Missionaries_and_cannibals_problem). Then, this tree is iterated with depth-first approach, printing all the visitations. The solutions to problem have a depth equals 9.

13 people like this

Posted: 10 years ago by Fabio Galuppo