Here are 10 little programs that are the solutions to the first ten even numbered programming challenges in Project Euler at MathsChallenge.net
#2. Find the sum of all the even terms in the Fibonacci sequence below one million.
#4. Find the largest palindrome made from the product of two 3-digit numbers.
#6. What is the difference between the sum of the squares and the square of the sums?
#8. Discover the largest product of five consecutive digits in the 1000-digit number.
#10. Calculate the sum of all the primes below one million.
#12. What is the first triangle number to have over five-hundred factors?
#14. Find the longest sequence using a starting number under one million.
#16. What is the sum of the digits of the number 21000?
#18. What is the maximum sum traveling from the top of the triangle to the base?
#20. Find the sum of digits in 100!
Mathschallenge.net is an educational math site run by British teacher Colin Hughes. He regularly posts math Jr. and Sr. level math problems and maintains an archive of past problems. Of interest to us is his Project Euler - a set of graded programming problems - current 21 problems arranged in 7 set of 3. It took me a few fun days solving all 21. Signup is required to participate and scores are posted under the userid you select. (I'm delphiforfun of course). At least two of the three problems at any level must be solved in order to gain access to the problems at the next level.
Since it would not be fair to post all 21 here, I decided to post the even numbered problems to give viewers the flavor of the competition.
These are "quick and dirty" programs - the kind you write when obtaining the answer is the primary motivation. Still there may be some techniques you can use in other places. I decided not to use any previously posted DF components or units, although the requirement to identify and use prime numbers, palindromes, permutations, and large integer arithmetic requires code which has already been posted elsewhere on DFF. Here you'll find the simplest versions of code to for these concepts.
As usual, have fun!
If you like this kind of thing, for gosh sakes, sign up at ProjectEuler.net and challenge yourself. If you do sign up, use "delphi" somewhere in your handle so I can see how the "Delphians" are doing.
Modified: November 07, 2008