Search
As of October, 2016, Embarcadero is offering a free release
of Delphi (Delphi
10.1 Berlin Starter Edition ). There
are a few restrictions, but it is a welcome step toward making
more programmers aware of the joys of Delphi. They do say
"Offer may be withdrawn at any time", so don't delay if you want
to check it out. Please use the
feedback link to let
me know if the link stops working.
Support DFF  Shop
If you shop at Amazon anyway, consider
using this link.
We receive a few cents from each
purchase. Thanks
Support DFF  Donate
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
Mensa^{®}
Daily Puzzlers
For over 15 years
Mensa PageADay calendars have provided several puzzles a year
for my programming pleasure. Coding "solvers" is most fun,
but many programs also allow user solving, convenient for "fill
in the blanks" type. Below are Amazon links to the
two most recent years.
Mensa^{®}
365 Puzzlers Calendar 2017
Mensa^{®}
365 Puzzlers Calendar 2018
(Hint: If you can
wait, current year calendars are usually on sale in January.)
Contact
Feedback:
Send an
email with your comments about this program (or anything else).

 
Problem Description
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.
#4. A palindromic number reads the same both ways. The largest palindrome made from
the product of two 2digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3digit numbers.
#6. The sum of the squares of the first ten natural numbers is, 1² + 2² + ... + 10² = 385.
The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)² = 55² = 3025.
Hence the difference between the sum of the squares of the first ten natural
numbers and the square of the sum is 3025 – 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
#8. Find the greatest product of five consecutive digits in the 1000digit number.
(See program for the number)
#10. The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below one million.
#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
factors (1,2,4,7,14,28).
Which is the first triangle number to have over fivehundred factors?
#14. The following iterative sequence is defined for the set of natural numbers:
n_{i+1}= n_{i }/
2 ( if n_{i} is even), n_{i+1} = 3n_{i} + 1 (if n_{i} is odd).
Using this rule and starting with 13, we generate the following sequence:
13, 40, 20, 10, 5, 16, 8, 4, 2, 1. It can be seen that this sequence (starting at 13 and finishing at 1) contains
10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.
Which starting number, under one million, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million.
#16. Work out the first 10 digits of the sum of the onehundred 50digit numbers defined below.
(See program for numbers.)
#18. By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total
sum from top to bottom is 23 (3 + 7 + 4 + 9).
3
7 5
2 4 6
8 5 9 3
Find the maximum total from top to bottom for the following triangle.
64
45 63
75 09 91
....22 more rows (see program for values, last row has 25 values)
#20. n! means n × (n – 1) × ... × 3 × 2 × 1.
Find the sum of the digits in the number 100!
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
graphsearching 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
Created: January 21, 2003 
Modified:
May 11, 2018

