Not kakuro, I'm trying to find polynomials with integer roots whose critical points are also integers. My first idea turned out to create too big a 'haystack' but then I remembered that one of the coefficients of a polynomial is the sum of the zeros. I'm hoping to use them to construct the polynomials I'm interested in. So I figure if I consider the sum of the zeros (the partitions here) it might cut the haystack down quite a bit. At least in the few trial runs I've done it seems to have helped a lot. It wouldn't automatically solve it, I guess you could say it's a "necessary but not sufficient" type of thing where I'd still have to sift through the partitions to find what I'm interested in. An important consideration is that the number of partitions of n increases very quickly, however I'm hopeful that with the restrictions I want to use it will cut down on the amount of stuff I'm not looking for.

I tried that program but I keep getting 'uninitialized value' errors on $max, $n & $level but I'm not sure how to fix them. I tried tye's attempt below & it seems to work great. It cuts back on a lot of the stuff I'm not looking for but I definitely want to try to get yours working too.

For example, here's part of what I've been using for a quartic, where is_approximately_an_integer is used to determine whether or not the derivative has roots "close enough" to integers, and poly_roots & poly_derivative are from the Math::Polynomial package:

grep { is_approximately_an_integer( @$_ ) } [ poly_roots( poly_derivative( # expanded form of x*(x - $x)*(x - $y)*(x - $z) 1, -$x - $y - $z, $x*$y + $x*$z + $y*$z, -$x*$y*$z, 0 ) ) ];

In reply to Re^2: How to restrict partitions by crunch_this!
in thread How to restrict partitions by crunch_this!

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.