[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
Here are 10 small programs that solve the first 10 even numbered problems from the Project Euler programming challenge at educational website mathschallenge.net.
#2. Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even valued terms below one
million in the sequence.
#12. The sequence of triangle numbers is generated by adding the natural numbers.
So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first
ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
The 7th triangle number, 28, is the first triangle number to have over five
Which is the first triangle number to have over five-hundred factors?
Find the maximum total from top to bottom for the following triangle.
Background & Techniques
I ran across this site several days ago and got hooked on writing the programs to solve the problems. Some are harder than others, but they are all fun! It is required to sign up to gain access to the problems and scores are posted by the handle selected. So you can check that ole "delphiforfun" is tied for 1st place having solved all 21 problems that are currently available. There are seven levels with 3 problems at each level.
The programs posted here are all beginner level programs based on my code length criteria - they have only 20 to 36 lines of user written code. The conceptual thinking required to solve them however is not beginner level. But that's part of the fun. Stretch your mind!
As you can see, the problems cover quite a span of topics: primes, factors, palindromes, factorials, large number arithmetic, and graph-searching come to mind.
I decided to post even numbered problems to prevent cheaters from just posting the answers these programs provide. (Even though in the long run such persons would only be cheating themselves.) One of the most important characteristics of a good programmer is persistence. If you don't give up, and the goal was reasonable in the first place, you will succeed! These programs all represent reasonable goals.
If you just download and run these programs, you will not have learned much. I would recommend that, if you plan to participate in the challenge, spend at least 8 hours on a problem before checking my solution. Then figure out why you couldn't figure it out and you will have learned something either way.
Running/Exploring the Program
Suggestions for Further Explorations
These and the rest of the problems on the Project Euler webpages at mathschallenge.net
Copyright © 2000-2017, Gary Darby All rights reserved.