Various comments so far:
1.Antirice asked if I can repeat the numbers: Answer is yes:
ie.. [ [1,2],[4,2]] is allowed.
2. pzbagel: In mentioning of next if $n =~ /0\d+/;. \d+ was necessary to because I just don't wanted the formed-numbers that begins with 0. Anywhere else 0 in the number is fine. For 2x2 matrix this should work fine.
3. I like Rhose's appraoch as initiated by CountZero.
4. Other apporach:, Start forming matrix starting from the highest divisor.
4. Few other related challanges are
- Find a matrix for each divisor possible with lowest possible total of numbers in the matrix. ex.. [[1 2] [3,0]]:Total = 6
- Origianl matrix can have numbers with K digits. K > 1.
Example: K= 2 [ [12, 34],[56,78]]
- It could be NXNXN Matrix : Example: 3 x 3 x 3 Matrix: If we take K= 1 here, according to Rhose's approach we will have 1000/27 = 35 as maximum divisor.
's answer at Re: Re: Matrix Formation
is a good but rather cumborsum attempt. The best answer for 3x3 matrix -> Highest divisor is '44'. I am sure coming up with 4x4 or 15x15 matrix answers would be quite challanging.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||