[Home] [Puzzles & Projects] [Delphi Techniques] [Math topics] [Library] [Utilities]
|
|
Problem Description Find a six digit number which, when multiplied by an integer Background & TechniquesThis is an ideal beginner's program illustrating trial and error solution techniques. Since there are about a million 6 digit integers, (900,000 if we start at 100,000), we should be able try them all in pretty short order. With each number to be tested, we'll split it into it's component digits, build up a number with the digits reversed, then see if the second is a single digit multiple of the first. The code provides the best description of the algorithm. I've added QueryPerformanceCounter procedure calls to get run time - about a second to check all 900,000 on my medium speed Celeron CPU. And we really don't have to check any higher than 500,000 (why?). A single procedure (SolveBtnClick) with about 30 lines of user written code keep this one in the beginner's category. Running/Exploring the Program
Suggestions for Further ExplorationsFive or seven digit numbers? Is there a pattern here?
Modified: May 11, 2018
|
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 2000-2018, Gary Darby All rights reserved. |