Pandigital Numbers

[Home]   [Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Available Now

Search

Google
 

Search WWW             

Search delphiforfun.org

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Help support DFF

 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.

 

Google
 

Search WWW

Search delphiforfun.org

 

 

Problem Description

  •  Pandigital numbers contain all of the digits 0 through 9 exactly once.
  •  "Almost pandigital" numbers contain the digits 1 through 9 exactly once.

As an introduction to pandigital numbers, write  a program that finds:

  1. The smallest pandigital number that is a perfect square.
  2. 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 added: 

  1.  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.)
  2. 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 once.
  3. 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.

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

There are pairs of  pandigital numbers who's products are palindromes.   How many can you find?
If abcdefghi is an "almost pandigital" number, find the only value satisfying  a/bc + d/ef +g/hi = 1.


 
Original Date: August 25,2002 

Modified: March 30, 2008

 

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2008, Gary Darby    All rights reserved.