www.procontechnology.com.au
To search our website - click here.

THE PUZZLE PAGE

Welcome to the puzzle page at www.procontechnology.com.au. I suppose I really became fascinated with solving maths puzzles or number puzzles by computer at university, where a teacher asked us to sum all six numbers of balls drawn in a local lotto game (called 'Tattslotto' where 6 numbers out of 45 are drawn). He then asked, "what would be the most frequent sum of the numbers drawn?" That was easy ... see if you can work it out. And, he also asked, "what is the frequency of occurence?" i.e. 1 out of how many draws sums to this most frequent number. No one in the class could work it out mathematically so we used a computer (an expensive mini-computer) to go through every possible combination until the solution was found. Of course, in those days, computers weren't very fast so it took hours to work this out. Anyway see if you can solve it mathematically or on your computer and let me know the solution. Here's some puzzles below, with computer programs to solve them, that might be of help ... Peter King.

Don’t forget, if you find this page useful (or even if you don’t) why not look around our website - you just might find something interesting, such as a fischertechnik robotic construction set or other things for yourself or that unique gift. Please also check the links below for more hot stuff. You might also be interested in our other webpages: Tips for ACER or ITSA scholarship tests and Maths tricks and tips.

PUZZLE 1.
This problem comes from The Age newspaper in Australia. It is called ATTEMPTATION NO. 1 by Albert Haddad. In the following addition, all the letters and astericks have replaced the digits 0 to 9. Where Z=7 and *=7, and the others eight letters are 0, 1, 2, 3, 5, 6, 8 or 9. Note, no two letters have the same value.

1a. Now, in trying to solve this puzzle it was easy to work out what E and P were. See if you can do that first! Now, you only need to solve for L, A, S, O, V and U. That's only a maximum of 6! (six factorial) = 6x5x4x3x2x1 = 720 combinations you could go through. So, rather than over stress my brain trying to work the solution out, I decided to write a small computer program to solve it for me. That in itself was a bit of a challenge! The simpliest solution was to pick the six values randomly and then test to see if the solution worked. In LOGO (A brilliant programming language that's ideal for solving little problems like this) I could simply PICK one number out of a list of numbers [0 1 2 3 5 6 8] - or a SET of numbers if you like and then REMOVE that number from the list before PICKing the next number out etc. To construct the 5 or 6 digit numbers from the individual digits was also easy in LOGO - simply use (WORD :P :L :E :A :S :E) etc. and then add the three numbers together and test whether the result is 777777. If so, the solution has been found! I wrote three programs, one for MSWLogo (FREE on the net although a donation to Multiple Sclerosis is suggested) available from www.softronix.com. The second program is for Terrapin Logo (a version of Logo that's easier for kids to use) available through me from www.terrapinlogo.com. And a third program, for comparison, written in QBASIC - available with DOS, Windows 95, 98 or NT (click here for more information). QBASIC has the advantage that it executes much faster, but it is definitely harder to program - check it out and see if you can figure out how my program works!

To download the program for MSWLogo - Click here (puzzle1.lgo 2KB)

To download the program for Terrapin Logo - Click here (puzzle1a.lgo 2KB)

To download the program for QBASIC - Click here (puzzle1a.txt 2KB)

To download and run a copy of QBASIC - Click here

1b. As an advanced programming exercise why not modify these programs to solve the puzzle for all eight variables including E and P. That means that there is now 8! (eight factorial) = 8x7x6x5x4x3x2x1 = 40320 possible combinations of these numbers - so it may take the computer a bit longer to come up with a solution! Of course, how fast it finds the solution depends on the sequence of random numbers the program produces. i.e. try changing the RERANDOM statement in Logo or RANDOMIZE in QBASIC and see what happens.

1c. As a further exercise try modifying the program so that it systematically goes through every combination of numbers (to the maximum of 40320) until the solution is found. You should be able to program this so that the algorithm can be easily changed for more (or even less) variables...so you'll be able to solve other puzzles readily! P.S. This may seem difficult at first but, believe me, the solution is rather short and elegant if not simple in the end!

PUZZLE 2.
I modified the above programs to solve ATTEMPTATION NO. 13 and found that there was another possible solution - if only the summation result was 3 digits long and not 4! So, try solving this:

Where T=3 and N=8, The others (O, B, E, R and ?) are either 1, 2, 4, 6 or 9. Once again, no two letters (or ?) are the same!

2a. Try solving this puzzle in Logo and QBASIC using the sample programs above. You might also wish to try other programming languages. As a special challenge why not try the fischertechnik control software called LLWIN which is a flowchart style language. Just click here to find out more about LLWIN and to download a FREE working copy of the program. I couldn't wait to share the LLWIN solution for this puzzle with you, so here it is - Click here (puzzle2.zip 11KB)

PUZZLE 3.
This problem also comes from The Age newspaper in Australia. It is called FIGURE IT OUT by Albert Haddad. In the following matrix of numbers, all the letters have replaced the digits 0 to 9. Where E=2 and K=6, and the others eight letters are 0, 1, 3, 4, 5, 7, 8 or 9. Note, no two letters have the same value. The letters across must sum to the value on the right, and the letters down must sum to the numbers at the bottom. The '?' represents one of the letters - you must find the letter it represents!

Here's the QBASIC program solution to this puzzle. Note, it provides a complete solution that solves it in the minimum time possible as explained in 1c above. Click here (puzzle3.txt 2KB) This program doesn't solve for '?'. Can you change the program to do that?

PUZZLE 4.
This puzzle came from a school teacher and is a good one for beginners. A student was given two 3 digit numbers (let's call them A and B), the student was meant to multiply them together but instead simply 'joined' them making a 6 digit number (let's call it C). For example if A=123 and B=456 then C=123456. It was found that C was exactly three times the correct result of A x B. What were the values of A and B given to the student? The solution below is in QBASIC. See if you can program it in Logo or another language!

FOR A = 100 TO 999

NEXT A

4b. As an extra challenge, there is one other multiple (not 3) that this also works for. What is the multiple? And, what do you notice about the values of A and B? Knowing this and the multiple, can you find the values of A and B using algebra?

PUZZLE 5.
This is another simple puzzle that can be solved in your head using simple divisibility tests featured on our maths tips and tricks page. Simply add a digit to each end of the number 527218 to make a number divisible by 36. Find all combinations of such numbers. The solution below is in QBASIC. See if you can program it in Logo or another language!

DEFLNG A-Z

FOR A = 1 TO 9

NEXT A

COMING SOON ... SUDOKU!
A program will be posted soon solving the 'sudoku' puzzle. This puzzle originated from Japan - apparently it's difficult to have crossword puzzles in the Japanese language so they do number puzzles instead. For more information on these puzzles go to: www.sudoku.org.uk

MORE PUZZLES?
Don't forget to bookmark this page so that you can return at a later date and get the solutions to these exercises. If you are interested in solving more puzzles, let me know by email at procontechnology@tpg.com.au

If there is enough interest, I'll continue to post more puzzles here and the solutions. I might even offer a few prizes!!!

MORE PROGRAMS?
If you are interested in Terrapin Logo or MSWLogo then I'm hoping to post more example programs here. Terrapin Logo comes with very few example programs so I've converted a few games (adventure, hangman, hotcold) and other programs from PC-Logo. I've also converted a few programs from MSWLogo to Terrapin Logo. They include, Hanio towers, analog clock and curves (Koch, Hilbert, Peano and Sierpinski).

Here's a program that generates prime numbers up to 32765. The challenge for you is to modify this program to generate primes up to 1,000 million or more. To see the program in QBASIC - Click here (prime1.txt 1KB)

To download a copy of QBASIC from Microsoft - Click here (olddos.exe 837KB)*

*to extract the files execute 'olddos.exe', the only files you need are QBASIC.EXE and QBASIC.HLP

USING VISUALBASIC FOR WINDOWS?
The QBASIC programs shown here can be run under VBW by simply placing the variable declarations (DEFINT, DIM) under the (General)-(Declarations) section and the remainder in the 'Form_Load' procedure. Change all 'print' statements to 'Debug.Print' to view the results in the immediate window (press Ctrl-G to view). The INKEY$ function is ignored by VBW so use Ctrl-Break to interrupt the program if necessary.