/heteroglot/README.md

https://github.com/eevee/project-euler · Markdown · 110 lines · 73 code · 37 blank · 0 comment · 0 complexity · 33d6083123fe5fc6d8a37da1104468d4 MD5 · raw file

  1. This is a set of Project Euler solutions in which no programming language is
  2. used twice.
  3. Each program begins with a comment containing the entire problem description.
  4. When run, each program prints the solution and a single newline to standard
  5. output.
  6. Programs are each a single source file named `nnn.ext`. (Unless they're not —
  7. see XSLT.) Most can be compiled/run by giving the filename to a standard
  8. compiler/interpreter. For esoteric runtimes (consider vimscript), the source
  9. may contain brief instructions on how to get the code to run, but this is only
  10. done when absolutely necessary.
  11. Note that when it matters, a POSIX-compatible shell is assumed, because I'm
  12. running Linux.
  13. # Rules
  14. The rules are loose and entirely subject to my interpretation, but I try to
  15. stick to the following:
  16. * Languages may not be reused. Variants are generally avoided, but the
  17. ultimate guideline is whether the result would be _interesting_.
  18. * Languages shall be chosen without regard for the requirements of the next
  19. problem. Ideally, I should have no idea what the next problem even is.
  20. * Trivial transformational scripts (in any language) are allowed in extreme
  21. cases if a language is particularly difficult to read or write. This
  22. exception exists solely for Whitespace.
  23. * Programs must perform the actual calculation. The general pattern is that
  24. any numbers or other parameters that appear in the problem are defined as
  25. constants within the program; changing the constants thus ought to produce
  26. the appropriate answer. (Programs are not, however, expected to deal with
  27. excessively large or malformed parameters.)
  28. # Languages used
  29. * Problem 1: Ruby
  30. _Add all the natural numbers below one thousand that are multiples of 3 or 5._
  31. * Problem 2: C
  32. _By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms._
  33. * Problem 3: C++
  34. _Find the largest prime factor of a composite number._
  35. * Problem 4: x86 assembly
  36. _Find the largest palindrome made from the product of two 3-digit numbers._
  37. * Problem 5: Brainfuck
  38. _What is the smallest number divisible by each of the numbers 1 to 20?_
  39. * Problem 6: Whitespace
  40. _What is the difference between the sum of the squares and the square of the sums?_
  41. * Problem 7: MUMPS
  42. _Find the 10001st prime._
  43. * Problem 8: vimscript
  44. _Discover the largest product of five consecutive digits in the 1000-digit number._
  45. * Problem 9: LOLcode
  46. _Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000._
  47. * Problem 10: Standard ML
  48. _Calculate the sum of all the primes below two million._
  49. * Problem 11: Bash
  50. _What is the greatest product of four adjacent numbers on the same straight line in the 20 by 20 grid?_
  51. * Problem 12: Prolog
  52. _What is the value of the first triangle number to have over five hundred divisors?_
  53. * Problem 13: Lua
  54. _Find the first ten digits of the sum of one-hundred 50-digit numbers._
  55. * Problem 14: XSLT
  56. _Find the longest sequence using a starting number under one million._
  57. * Problem 15: COBOL
  58. _Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner?_
  59. * Problem 16: Pascal
  60. _Power digit sum_
  61. * Problem 17: Inform7
  62. _Number letter counts_
  63. * ...
  64. * Problem 67: Haskell
  65. _Using an efficient algorithm find the maximal sum in the triangle?_
  66. ## Declared unusable
  67. For posterity, the following languages have been attempted in the past, but
  68. have been ruled _unusable_ by executive decree.
  69. * Malbolge
  70. # Links
  71. * [Project Euler](http://projecteuler.net/)
  72. * [Full list of Project Euler problems](http://projecteuler.net/problems)
  73. * [Blog series about these solutions](http://me.veekun.com/blog/categories/project-euler/)