 # Thread: Programming Puzzle 26 - Mysterious Elevens

1. ## Programming Puzzle 26 - Mysterious Elevens

Puzzle 26 -

Your algebra teacher tells you that every three digit number is divisible evenly by 11 if the middle digit is the sum of the first and third digits. Naturally your teacher expects you to prove this using algebra, but ... your algebra is incredibly rusty.

Your task therefore is to write an xbasic program that proves or disproves the hypothesis. Your solution should list all the three digit numbers in which the middle digit is the sum of the first and third digits, and for each it should show both the quotient and the remainder when the number is divided by 11.

You may dump the results to the trace window, or to a disk file.

Have fun.

Puzzle idea, credit plus.maths.org. 2. ## Re: Programming Puzzle 26 - Mysterious Elevens

hello

here is mine - 3. ## Re: Programming Puzzle 26 - Mysterious Elevens

gandhi,

Hey that's quickly done! Nice!

I have shown your source to the "professor" and he has a question for you. I hope it makes sense to you, (it's got me scratching my head). Anyway here's his question: "If the object is to prove or disprove the mathematical hypothesis why not show the results for all 3 digit numbers that are evenly divisible by 11?" Does that mean anything to you?

Thanks. 4. ## Re: Programming Puzzle 26 - Mysterious Elevens

hello

i am not sure i get it.
may be you could ask the prof. what is the difference between mod = 0 and evenly divisible.
i don't like scratching my head, not much hair left. 5. ## Re: Programming Puzzle 26 - Mysterious Elevens

Hah! I know what you mean!

I've consulted "the great one" again and he agrees with you. if the mod result is 0 then the number is evenly divisible. However, in your script you only show results if the middle digit is equal to the sum of the first and third. For an effective "proof" shouldn't you show all results? Otherwise, your script would conceal numbers that are evenly divisible by 11, but have middle digits that do NOT equal the sum of the 1st and 3rd. In his words, "Gandhi has shown us the numbers that are both evenly divisible by 11 AND which have middle digits equal to the sum of the outer digits, but this is not a valid proof of the hypothesis, since the trace window does not show us the results from all numbers that are evenly divisible by 11". 6. ## Re: Programming Puzzle 26 - Mysterious Elevens

here is an improved version
(the second one) 7. ## Re: Programming Puzzle 26 - Mysterious Elevens

gandhi,

That's very interesting! You've proven that if the three digit number is evenly divisible by 11 the middle digit is not always equal to the sum of the outer digits. You've also discovered a circumstance in which the 3 digit number is evenly divisible by 11 based on a new relationship between first, second and third digits. Nice! The professor is impressed. #### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•