As a way of keeping things fresh and exploring new languages, I started doing one Project Euler problem a day without repeating a programming language.
(It very quickly turned into "one whenever I feel like it", sometimes more than one a day, sometimes none. It should also be noted that the point of this exercise is quick exposure to a wide variety of languages, and not any sort of mastery; a lot of the code here likely is not "idiomatic", and will sometimes be the only code I've written in that language in ten years or ever.)
Idea shamelessly stolen from eevee.
Problems solved so far, and which language was used to solve them, in order:
- Find the sum of all the multiples of 3 or 5 below 1000. (Python)
- By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. (Ruby)
- What is the largest prime factor of the number 600851475143 ? (C)
- Find the largest palindrome made from the product of two 3-digit numbers. (Java)
- Coffeescript (What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?)
- Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. (Lolcode)
- What is the 10 001st prime number? (Lua)
- Find the thirteen adjacent digits in the [provided] 1000-digit number that have the greatest product. What is the value of this product? (Perl)
- There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. (C++; author's note, this is a single printf away from being C, but I REALLY did not know C++ at the time that I wrote this. :))
- Find the sum of all the primes below two million. (Haskell)
- What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the [provided] 20×20 grid? (Go)
- What is the value of the first triangle number to have over five hundred divisors? (Rust)
- Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. (Erlang)
- Which starting number, under one million, produces the longest Collatz chain? (Clojure)
- Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, how many such routes are there through a 20×20 grid? (JavaScript)
- What is the sum of the digits of the number 2^1000? (Scala)
- If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? (Swift)
- Find the maximum total from top to bottom of the triangle below. (C#)
- How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? (Elm)
- Find the sum of the digits in the number 100! (Elixir)
- Find the sum of all amicable numbers less than 10000. (R)
- Find the sum of all "name scores" in a provided file. (Bash)
- Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. (Kotlin)
- Find the millionth permutation of the digits zero through nine. (FiM++)
- Find the index of the first Fibonacci number with 1000 digits. (Dart)
- Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
- Find the product of the coefficients a and b for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n = 0. (Ballerina)
- What is the sum of both diagonals in a 1001 by 1001 spiral? (Zig)
- How many distinct terms are in the sequence generated by a^b for 2 <= a <= 100 and 2 <= b <= 100? (Wren)
- Find the sum of all the numbers that can be written as the sum of fifth powers of their digits. (Groovy)
- How many different ways can £2 be made using any number of coins? (Scheme)
- Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital. (PHP)
- Find the product of the denominators of all four two-digit curious fractions. (Common LISP)
- Find the sum of all curious numbers. (Prolog)
- How many circular primes are there below one million? (Nim)
- Find the sum of all numbers <= 1000000 which are palindromes in both base 10 and base 2. (Gleam)
- Find the sum of all eleven integers for which all truncations in either direction are prime. (Unison)
- What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2,...,n) where n>1? (Raku)
- Find the product of the 1st, 10th, 100th, 1000th, 10000th, 100000th, and 1000000th digits of Champernowne's constant. (F#)
- Find the last ten digits of the series 1^1 + 2^2 + 3^3 ... + 1000^1000. (Julia)