Is it cheating...

# Thread: Is it cheating...

1. Senior Member
Join Date
Dec 1969
Posts
11,334

## Is it cheating...

to do my daughter&#039;s math homework through C++ code?<BR><BR>She has this 3 problems to do in her class.. they can&#039;t get it. I&#039;m getting to write code to do it. They (wife and kid) call it cheating.<BR><BR>Given 1, 2, 3, 4, 5, 6, 7, 8, write each number once so that all columns and rows equal 12. The grid looks like (NONE is a blank cell):<BR><BR>X X X<BR>X NONE X<BR>X X X<BR><BR>Given 1, 2, 3, 4, 5, 6, 7, all columns equal 12 up and down:<BR><BR>X X X<BR>NONE X NONE<BR>X X X<BR><BR><BR>Given 1, 2, 3, 4, 5, 6, 7, 8, 9 all columns and rows should equal 15:<BR><BR>X X X<BR>X X X<BR>X X X<BR><BR><BR><BR><BR>THis isn&#039;t cheatin&#039;, is it? Shall I give the teacher the code to prove it???

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## I give up...

...how does giving the teacher the code prove anything??? Other than that you cheated.<BR><BR>The last problem is the classic version. Except that the diagonals should total 15, as well.<BR><BR>And if you write it via code, will your code eliminate all the reflections and rotations that are actually the same answer?<BR><BR>HEY! I just did number 3!!!<BR><BR>Tell her that secret is that the 9 has to go in the middle of one side. After you get that, the other numbers just fall into place! (There&#039;s only two ways to go after you put the 9 there. One works, one quickly falls apart.)<BR><BR>Oh, and the diagonals do add up to 15.<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: I give up...

LOL!<BR><BR>Well, to impress upon the teacher that code is the way to do it (and to confuse her)<BR><BR>You did the diagonals as well???<BR><BR>Ah well, I just spent the whole time trying to vamp up .Net, and I can&#039;t even create a simple console program in C++. I&#039;m gonna do the vbs version right now..

4. Senior Member
Join Date
Dec 1969
Posts
11,334

## And I just looked at her homework...

and it did say the "classic" diagnols should equal 15 as well.<BR><BR>****.

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## By the by...

...if you try 9 in any of the other positions (there are only two: corner or center...and which I did), you quickly realize that there isn&#039;t any possible solution. So it&#039;s no big leap to put the 9 in the middle of a side.<BR><BR>And I don&#039;t think you *can* get a solution with rows and columns equal to 15 without diagonals happening, too.<BR><BR>

6. Senior Member
Join Date
Dec 1969
Posts
96,118

## And #1 is just as trivial.

I assumed that you had to treat the whole in the middle as a zero, no?<BR><BR>So just try putting 8 in one corner: That means that you need numbers adding up to 4 along both of the adjacent sides. CAN&#039;T BE. Only 1+3 add up to 4.<BR><BR>Okay, so put 8 in the middle of one side. Then the number opposite (across the NONE square from it) has to be 4. Yes?<BR>And 1 and 3 have to be beside 8, yes? And the rest just falls out automatically. Takes about 30 seconds.<BR><BR><BR><BR>

7. Senior Member
Join Date
Dec 1969
Posts
11,334

## I'm trying in Java now...

just for the fun of it.<BR><BR>This has now become *my* project.<BR><BR>(I love sometimes proving her teachers wrong, and I&#039;ll have the code to prove it ;-))

8. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: And #1 is just as trivial.

Heh, for you and me it&#039;s trivial. My daughter is having huge problems, and my wife can&#039;t get it either. I have to write code just so I "told them so". Who else can do thousands of permutations per second than a computer?<BR><BR>I&#039;d like to talk to you personally also Bill, concerning a business... I knew you had problems, and I&#039;d like to avoid any pitfalls. If you can send me a number to s c i m i n o @ c o x dot NET I&#039;d give ya a ring.

9. Senior Member
Join Date
Dec 1969
Posts
96,118

## #2 is impossible!

You have two columns where the total must be 12 in only two numbers.<BR><BR>Yet you have only two numbers in the entire set of {1 2 3 4 5 6 7} that add up to 12!<BR><BR>7 and 5. <BR><BR>So how do you get the other column to add up to 12???<BR><BR>6 and 4 fall a couple short.<BR><BR>This one is provably impossible.<BR><BR>

10. Senior Member
Join Date
Dec 1969
Posts
96,118

## I *think* there is only one solution...

...barring reflections and rotations.<BR><BR>In fact, I&#039;d bet on it.<BR><BR>I&#039;ll get in touch from home, later.<BR><BR>

#### Posting Permissions

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