Sign in
Code Monkey Have Fun
Options
Email Blog Author
RSS for posts
Atom
RSS for comments
OK
Search
Tags
Ape
Calculators
Concatenative Languages
Continuations
CPS
Curiosities
DCPU-16
Demo Code
F#
Forth
FRP
FScheme
HP-35
HPCalcs
Interpreters
Logo
Magimathics
Pages
Project Euler
Recursion
RPN
Scheme
TransForth
Turtle Graphics
VMs
Archive
Archives
April 2013
(1)
March 2013
(1)
April 2012
(3)
February 2012
(1)
January 2012
(2)
December 2011
(1)
September 2011
(2)
August 2011
(1)
June 2011
(1)
April 2011
(1)
March 2011
(2)
February 2011
(5)
January 2011
(2)
November 2010
(1)
October 2010
(1)
September 2010
(9)
June 2010
(2)
March 2010
(3)
February 2010
(3)
January 2010
(9)
December 2009
(2)
October 2009
(1)
September 2009
(4)
August 2009
(7)
April 2009
(3)
December 2008
(1)
September 2007
(1)
April 2007
(3)
November 2005
(1)
February 1996
(1)
Blog - Link List
Blogroll
Tomas Petricek
Harry Pierson
Dustin Campbell
Don Syme
Luca Bolognese
Luke Hoban
Matthew Podwysocki
James Iry
Steve Horsfield
Tom Kirby-Green
Mads Torgersen
Wes Dyer
Retro Programming - John Metcalf
Gram Wheeler
Favorites
Talks
Posts
Quotes
August, 2009
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Code Monkey Have Fun
Project Euler Problem #1
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Project Euler is pretty darn cool. It’s a bunch of mathematical problems that require programming to solve. I’m having fun doing them in F#. They start very simple but quickly become more difficult. Problem 1 is to find the sum of all the multiples...
Code Monkey Have Fun
Project Euler Problem #2
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Sum of even terms in Fibonacci sequence which are < four-million : (1, 1) |> Seq.unfold ( fun (a, b) -> Some(a, (b, a + b))) // fibs |> Seq.takeWhile ( fun x -> x <= 4000000) |> Seq.filter ( fun x -> x % 2 = 0) ...
Code Monkey Have Fun
Project Euler Problem #3
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Largest prime factor of 600851475143 : let primeFactors n = let isFactor n d = n % d = 0L let nextFactor n d = seq {d..n} |> Seq.find (isFactor n) (n, 2L, []) |> Seq.unfold ( fun (n, d, a) -> if isFactor n d then Some(d, ((n...
Code Monkey Have Fun
Project Euler Problem #4
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Largest palindrome from product of two 3-digit numbers : let isPalendrome n = let s = n.ToString() |> List.of_seq s = List.rev s seq { for a in 100..999 do for b in a..999 -> a * b } |> Seq.filter isPalendrome |> Seq.max
Code Monkey Have Fun
Project Euler Problem #5
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Smallest number divisible by each of 1 to 20 : First cut (takes almost an hour to execute!): let isFactor n d = n % d = 0 {1..Int32.MaxValue} |> Seq.find ( fun n -> [1..20] |> List.forall (isFactor n)) Second cut (takes a...
Code Monkey Have Fun
Project Euler Problem #6
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Difference between sum of the squares and the square of the sum of 1 - 100 : ( fun ns -> let sqr x = x * x (sqr (List.sum ns)) - (List.map sqr ns |> List.sum) ) [1..100]
Code Monkey Have Fun
Project Euler Problem #7
Posted
over 4 years ago
by
Ashley Nathan Feniello
0
Comments
Find the 10001st prime let naturals = Seq.unfold ( fun i -> Some(i, i + 1 )) let primes = naturals 2 |> Seq.filter ( fun n -> seq { 2.. int (sqrt (float n)) } |> Seq.forall ( fun x -> n % x <> 0 )) Seq.nth 10000 primes
Page 1 of 1 (7 items)
MSDN Blogs
>
Code Monkey Have Fun
>
August, 2009
Social Media Sharing