This is a set of Project Euler solutions in which no programming language is used twice.
Each program begins with a comment containing the entire problem description. When run, each program prints the solution and a single newline to standard output.
Programs are each a single source file named nnn.ext. (Unless they're not —
see XSLT.) Most can be compiled/run by giving the filename to a standard
compiler/interpreter. For esoteric runtimes (consider vimscript), the source
may contain brief instructions on how to get the code to run, but this is only
done when absolutely necessary.
Note that when it matters, a POSIX-compatible shell is assumed, because I'm running Linux.
Rules
The rules are loose and entirely subject to my interpretation, but I try to stick to the following:
-
Languages may not be reused. Variants are generally avoided, but the ultimate guideline is whether the result would be interesting.
-
Languages shall be chosen without regard for the requirements of the next problem. Ideally, I should have no idea what the next problem even is.
-
Trivial transformational scripts (in any language) are allowed in extreme cases if a language is particularly difficult to read or write. This exception exists solely for Whitespace.
-
Programs must perform the actual calculation. The general pattern is that any numbers or other parameters that appear in the problem are defined as constants within the program; changing the constants thus ought to produce the appropriate answer. (Programs are not, however, expected to deal with excessively large or malformed parameters.)
Languages used
-
Problem 1: Ruby
Add all the natural numbers below one thousand that are multiples of 3 or 5. -
Problem 2: C
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. -
Problem 3: C++
Find the largest prime factor of a composite number. -
Problem 4: x86 assembly
Find the largest palindrome made from the product of two 3-digit numbers. -
Problem 5: Brainfuck
What is the smallest number divisible by each of the numbers 1 to 20? -
Problem 6: Whitespace
What is the difference between the sum of the squares and the square of the sums? -
Problem 7: MUMPS
Find the 10001st prime. -
Problem 8: vimscript
Discover the largest product of five consecutive digits in the 1000-digit number. -
Problem 9: LOLcode
Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000. -
Problem 10: Standard ML
Calculate the sum of all the primes below two million. -
Problem 11: Bash
What is the greatest product of four adjacent numbers on the same straight line in the 20 by 20 grid? -
Problem 12: Prolog
What is the value of the first triangle number to have over five hundred divisors? -
Problem 13: Lua
Find the first ten digits of the sum of one-hundred 50-digit numbers. -
Problem 14: XSLT
Find the longest sequence using a starting number under one million. -
Problem 15: COBOL
Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner? -
Problem 16: Pascal
Power digit sum -
Problem 17: Inform7
Number letter counts -
...
-
Problem 67: Haskell
Using an efficient algorithm find the maximal sum in the triangle?
Declared unusable
For posterity, the following languages have been attempted in the past, but have been ruled unusable by executive decree.
- Malbolge