So, how have I solved part one of the puzzle? (I have, honestly!) I
wrote a program in Hisoft Pascal 4, which generated each palindromic number in
ascending order, and then tested them to see if they met the conditions. The
program used the following declarations to set up a data structure capable of
holding the big numbers.
DIGIT = 0..9;
NUMBER = ARRAY [1..6] OF DIGIT;
BIGNUMBER = ARRAY [1.12] OF DIGIT;
STARTAT, VALUE : NUMBER;
RESULT : BIGNUMBER;
The rest of the program consists mainly of routines which manipulate the arrays
of digits, which could be of any length, if you wanted enormous accuracy. One
procedure puts the square of VALUE into RESULT, another kmocks a million off,
and so on. Of course, there is no room to print the whole program here. When
run, it took seven minutes to come up with the answer, which I am not going to
tell you, as that would not help you to improve your programming skills. A more
recent revision of the same program, which generates its palindromic numbers a
faster way, gives the six suitable numbers less than a million in just under ten
minutes, and could be made to go even faster, if I could be bothered to do it,
simply by changing the routine that squares the number to take advantage of the
symmetry of the number. The most important thing, I think, to come out of this,
unless I get the £5000 at the end of it all, is the realisation that the people
who used to annoy me by going on about “Problem Solving" with Pascal were right.
All except one...
Great Stupid Remarks of the Twentieth Century.
In a recent edition (16/8/82) of Datalink, Margaret Park writes:–
"Edsger Djikstra the programming guru credited with the invention of structured
programming, damned the language completely by saying that programmers who had
started on Basic (sic) were unteachable. "As potential programmers," he said,
“they are mentally mutilated beyond hope of regeneration.”"
It is important to realise that these people who are "credited" with
inventing this, that, or indeed the other, have hardly ever done so. If you
think Arthur C. Clarke really invented the communication satellite, you need
your head looked at. And if Marshall McLuhan was right, I can send in a blank
tape, instead of going to all the bother of writing this article at all, on the
grounds that "the medium is the message". All these "gurus" can do is make a
nice after dinner speech. They each select a theme, and choose a set of suitably
far-out, trendy things to say, and make a fortune for themselves on what Douglas
Adams has rightly identified as the “Chat Show Circuit". Structured programming
is a method of programming that is independant of the programming language in
use. You can write structured programs in zarking machine code. You can write
them in BASIC, and it may even be possible to write them in Pilot. You may have
had a Nascom 1 when there was no BASIC available for it, and have written
structured programs for that, too. And along comes this guy Djockstrap, and
tells you that your brain is too curdled for you to learn any new language,
ever, no matter how you try. Well, I wonder what language Djikstra actually
learned to program in, ‘cos he looks very old in the photograph in Datalink. It
was almost certainly Fortran. Nascom guru Doctor Dark, inventor of the
Hyperspace Beer-Drive writes, "Wow, he was lucky he didn’t learn Cobol first.
That makes your w***y drop off..."