Fixed blog post: Puzzled Programmers
This commit is contained in:
parent
3f5cc2a20c
commit
68081d851e
1 changed files with 7 additions and 8 deletions
|
|
@ -16,7 +16,7 @@ machines:
|
||||||
name: None
|
name: None
|
||||||
---
|
---
|
||||||
|
|
||||||
One of books I used to have a copy of (and perhaps still do, in the bowels of my storage unit) was "Puzzled Programmers"
|
A book I used to have a copy of (and perhaps still do, in the bowels of my storage unit) was "Puzzled Programmers"
|
||||||
by Michael Wiesenberg. It was published by Microsoft Press in 1987, and I recently rediscovered an online copy in the
|
by Michael Wiesenberg. It was published by Microsoft Press in 1987, and I recently rediscovered an online copy in the
|
||||||
[Internet Archive's](https://archive.org) [Open Library](https://openlibrary.org):
|
[Internet Archive's](https://archive.org) [Open Library](https://openlibrary.org):
|
||||||
|
|
||||||
|
|
@ -46,13 +46,13 @@ of the programs presented in the solution to Puzzle 5.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
*Apple Pascal
|
*Apple Pascal
|
||||||
|
|
||||||
This almost seemed like an invitation to try my hand at Puzzle #5, and to see how a PCjs "machine" fared.
|
This almost seemed like an invitation to try my hand at Puzzle #5 and see how a PCjs "machine" compared.
|
||||||
|
|
||||||
### A Pleasant Fourthsum
|
### A Pleasant Fourthsum
|
||||||
|
|
||||||
I skipped ahead to page 27, "Puzzle 5: A Pleasant Fourthsum", and started reading. I have to admit that the story
|
I skipped ahead to page 27, "Puzzle 5: A Pleasant Fourthsum", and started reading. I have to admit that the story
|
||||||
completely failed to interest me. There were lots of irrelevant details about a delicious breakfast that this imaginary
|
completely failed to interest me. There were lots of irrelevant details about a delicious breakfast that this imaginary
|
||||||
bunch of successful twenty-somethings were enjoying, when suddenly one of them says:
|
bunch of successful twenty-somethings was enjoying, when suddenly one of them says:
|
||||||
|
|
||||||
"Before we get into the future of languages at I-Q, I've got a great computer puzzle for everyone."
|
"Before we get into the future of languages at I-Q, I've got a great computer puzzle for everyone."
|
||||||
|
|
||||||
|
|
@ -167,8 +167,7 @@ main()
|
||||||
partsum = h000 + i00 + j0;
|
partsum = h000 + i00 + j0;
|
||||||
part4ths = pwr[h] + pwr[i] + pwr[j];
|
part4ths = pwr[h] + pwr[i] + pwr[j];
|
||||||
for ( k = 0; k <= 9; k++) { /* ones digit */
|
for ( k = 0; k <= 9; k++) { /* ones digit */
|
||||||
sum = partsum + k; /* this produces the four-digit
|
sum = partsum + k; /* this produces the four-digit number */
|
||||||
number */
|
|
||||||
if (part4ths + pwr[k] == sum) {
|
if (part4ths + pwr[k] == sum) {
|
||||||
if (!l) printf("%d = %d^4 + %d^4 + %d^4 + %d^4\n",
|
if (!l) printf("%d = %d^4 + %d^4 + %d^4 + %d^4\n",
|
||||||
sum, h, i, j, k);
|
sum, h, i, j, k);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue