All,
A magic square is an NxN square filled with distinct integers where all columns, rows and diagonals add up to the same value. Here is an example 3x3:
4 3 8 9 5 1 2 7 6

What I am trying to create has similar properties (all selections add up to the same value). A selection is defined where N numbers are chosen from the square such that each column and row may only have 1 number selected from it. Here are the possible choices for a 3x3.

SQUARE A B C D E F G H I SELECTIONS (order is not important) A E I A H F D B I D H C G B F G E C

This would be trivial if there wasn't a requirement for distinct values (making all values 1 for instance would suffice). Making a 2x2 is also trivial.

3 9 1 7 3 + 7 = 10 1 + 9 = 10

Ultimately, I would like squares for N=3, N=4, N=5 and possibly N=6. It doesn't matter what sum the selections add up to provided that each value is a distinct integer. Can you do it?

Cheers - L~R


In reply to Not A Magic Square But Similar by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.