Get a Jumpstart with our Sample Apps
Results 1 to 7 of 7

Thread: Programming Puzzle 26 - Mysterious Elevens

  1. #1
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default 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. #2
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Programming Puzzle 26 - Mysterious Elevens

    hello

    here is mine -
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default 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. #4
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default 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.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  5. #5
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default 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. #6
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Programming Puzzle 26 - Mysterious Elevens

    here is an improved version
    (the second one)
    Last edited by GGandhi; 06-03-2012 at 06:44 PM.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,298

    Default 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.

Similar Threads

  1. Programming Puzzle 23 - For / Next Loop
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 9
    Last Post: 07-18-2012, 07:54 PM
  2. Programming Puzzle 22 - What do you Mean?
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 5
    Last Post: 05-23-2012, 08:09 AM
  3. Programming Puzzle 3 - Fractions, anyone?
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 7
    Last Post: 11-08-2011, 06:40 AM
  4. Programming Puzzle 21 - Got ini ?
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 5
    Last Post: 09-08-2011, 10:19 PM
  5. Programming Puzzle 11 - More Loops
    By Tom Cone Jr in forum Xbasic Programming Puzzles
    Replies: 11
    Last Post: 08-20-2011, 05:50 PM

Posting Permissions

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