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
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.
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.
e-mail with your comments about this program (or anything else).
- Pandigital numbers contain all of the digits 0 through 9 exactly once.
- "Almost pandigital" numbers contain no
zeros and the digits 1 through 9 exactly once.
As an introduction to pandigital numbers,
write a program that finds:
- The smallest pandigital number that is a perfect square.
- A number and it's square which together contain digits 1 through 9 exactly
once (i.e. form an "almost pandigital" number.
Addendum March 30, 2008: Solutions
for three additional sample problems proposed by viewers have been
- Find a pandigital number in which each subset of the first
N digits considered as an integer is exactly divisible by N.
(For example. the number cannot be 1234567890 because even though
"1" is divisible by 1, "12" is divisible by 2, and "123" is
divisible by 3, "1234" is not divisible by 4.)
- Find all equations of the form a x b = c with the property that
a, b, and c are integers and collectively they form an almost
pandigital number, i.e. they contain the digits 1 through 9 exactly
- Find all almost pandigital numbers, using digits 1 thru 9 only
once each, with the property that its square contains each digit 1
thru 9 twice.
Addendum May 31, 2010: Version 3.1 adds one more problem
today. This solves the problem posed by Listener Crossword #4088,
"Digimix". It seems that "Listener" crossword puzzles are
published weekly in the London Times which charges for current puzzles
(!) but are available for free after a few weeks at
- Find integers X and Y which together
form an Almost pandigital number (X and Y together contain only the
digits 1 through 9 exactly once) and the sum of whose squares(X2
+ Y2) is also Almost pandigital.
Background & Techniques.
Both problems depend on generating pandigital
numbers in increasing sequence. Function GetNextPandigital
performs this job for us. It uses the Sawada/SEPA
permutation algorithm introduced in Permutes1.
Some definitions of pandigital specify that it
cannot begin with 0, others do not and I haven't found an
"official" definition. In solving the first problem, I
added a checkbox that lets the user decide if leading zeros count.
Allowing a leading zero, the smallest pandigital is 0123456789;
without a leading zero the smallest is 1023456789.
Running/Exploring the Program
Suggestions for Further Explorations
pairs of pandigital numbers who's products are
palindromes. How many can you find?
abcdefghi is an "almost pandigital" number, find the only
value satisfying a/bc + d/ef +g/hi = 1.
|Original Date: August 25,2002
February 18, 2016