With 4 minutes to spare, I reached my goal of 20 project Euler problems in different languages in 24 hours. I learned a lot of languages, some real, some not so real - but overall this was very fun, and I may try to extend this challenge to more (esoteric) language over longer stretches of time.

List of all languages, in order of use:

BrainFuck

Haskell

J

Ruby

Whenever

Ook!

Racket/Scheme

Eyes / K (if you want a real language...I did the multiplication in K after seeing the numbers)

Javascript

sML

PHP

Go

Common Lisp

C++

Fortran 95

Python

ELM

Scala

Perl

Java

Problem 14: C++

Find the integer less than 1000000 which generates the longest Collatz sequence

https://dl.dropboxusercontent.com/u/34972177/PELC/e14.cpp

Problem 15: Fortran 95~

In a 20x20 grid, how many routes are there from the top left corner to the bottom right corner, moving only down and right?

So, this problem involved doing math with numbers too big for Fortran...so after implementing the "real" solution in Fortran, the answer I output is a multiplication that I simplified by hand-cancelling a division

https://dl.dropboxusercontent.com/u/34972177/PELC/e15.f95

Problem 16: Python

Find the sum of the digits of 2^1000

https://dl.dropboxusercontent.com/u/34972177/PELC/e16.py

Problem 17: Elm

If one were to write out the numbers 1 to 1000 in British English, how many characters (minus spaces and hyphens) would that require?

https://dl.dropboxusercontent.com/u/34972177/PELC/e17.elm

Problem 18: Scala

Find the maximal sum moving from the top to the bottom of a triangle of numbers.

https://dl.dropboxusercontent.com/u/34972177/PELC/e18.scala

Problem 19: Perl

This was my final problem that I solved: the solution is Perl, which I learned just by looking at someone else's Perl solution to an earlier PE problem, and, because I accidentally thought there were 1000 years in a century, I didn't manage to get the answer until 2:56...but I got it in on time!

How many Sundays fell on the first of a month in the 20th century?

https://dl.dropboxusercontent.com/u/34972177/PELC/e19.pl

Problem 20: Java

Find the sum of the digits on 100!

https://dl.dropboxusercontent.com/u/34972177/PELC/e20.java

## No comments:

## Post a Comment