Raul,
Yes, the original Quora question specified positive factors only, but i
forgot to include that in the specification.

Skip

Skip Cave
Cave Consulting LLC

On Sat, Nov 4, 2017 at 3:52 AM, Raul Miller <[email protected]> wrote:

> Well, ok, though that was not a part of your re-specification this time.
>
> Actually, though, re-reading your spec, i left out a factor of 16 of
> the solutions: integers can be negative and as long as we include an
> even number of negatives they cancel out in a product.
>
> Thanks,
>
> --
> Raul
>
>
> On Sat, Nov 4, 2017 at 2:28 AM, 'Skip Cave' via Programming
> <[email protected]> wrote:
> > Raul, very nice!
> >
> > Actually I prefer the solution that doesn't allow 1 as a factor of p. Of
> > course, that restricts the max number of partitions to the max number of
> > prime factors of any p. That also greatly reduces the number of partition
> > instances that will be generated. Then:
> >
> > 5 par 358258
> >
> > ┌─┬─┬──┬──┬───┐
> >
> > │2│7│11│13│179│
> >
> > └─┴─┴──┴──┴───┘
> >
> > Skip
> >
> > Skip Cave
> > Cave Consulting LLC
> >
> > On Fri, Nov 3, 2017 at 2:40 AM, Raul Miller <[email protected]>
> wrote:
> >
> >> So... 358358 has five prime factors (32 integer factors). We want to
> >> find all sorted sequences (not sets - values can repeat) of five of
> >> those factors whose product is 358358.
> >>
> >> To restrict our search, we can investigate only those sorted sequences
> >> of "number of prime factors represented in the variable" whose sum is
> >> five:
> >>
> >>    ~./:~"1 (#~ 5=+/"1) 6 #.inv i.6^5
> >> 0 0 0 0 5
> >> 0 0 0 1 4
> >> 0 0 0 2 3
> >> 0 0 1 1 3
> >> 0 0 1 2 2
> >> 0 1 1 1 2
> >> 1 1 1 1 1
> >>
> >> In other words, the results of these seven expressions (use
> >> require'stats' first to get comb):
> >>
> >>    1 1 1 1
> >>
> >> 358358
> >>    (1 1 1,(358358%*/),*/)"1 (4 comb 5){q:358358
> >>    /:~"1 (1 1 1,(358358%*/),*/)"1 (3 comb 5){q:358358
> >>    /:~"1 (1 1,q:@(358358%*/),*/)"1 (3 comb 5){q:358358
> >>    ~./:~"1 (1 1,({.,*/@}.)@q:@(358358%*/),*/)"1 (2 comb 5){q:358358
> >>     /:~"1 (1,q:@(358358%*/),*/)"1 (2 comb 5){q:358358
> >>    q:358358
> >>
> >> That's 44 different solutions:
> >>
> >> 1  1  1   1 358358
> >> 1  1  1 179   2002
> >> 1  1  1  13  27566
> >> 1  1  1  11  32578
> >> 1  1  1   7  51194
> >> 1  1  1   2 179179
> >> 1  1  1 154   2327
> >> 1  1  1 182   1969
> >> 1  1  1 143   2506
> >> 1  1  1 286   1253
> >> 1  1  1  91   3938
> >> 1  1  1  77   4654
> >> 1  1  1 358   1001
> >> 1  1  1  26  13783
> >> 1  1  1  22  16289
> >> 1  1  1  14  25597
> >> 1  1 13 154    179
> >> 1  1 11 179    182
> >> 1  1 11  13   2506
> >> 1  1  7 179    286
> >> 1  1  7  13   3938
> >> 1  1  7  11   4654
> >> 1  1  2 179   1001
> >> 1  1  2  13  13783
> >> 1  1  2  11  16289
> >> 1  1  2   7  25597
> >> 1  1 11  14   2327
> >> 1  1  7  22   2327
> >> 1  1  7  26   1969
> >> 1  1  7 143    358
> >> 1  1  2  77   2327
> >> 1  1  2  91   1969
> >> 1  1  2 143   1253
> >> 1 11 13  14    179
> >> 1  7 13  22    179
> >> 1  7 11  26    179
> >> 1  7 11  13    358
> >> 1  2 13  77    179
> >> 1  2 11  91    179
> >> 1  2 11  13   1253
> >> 1  2  7 143    179
> >> 1  2  7  13   1969
> >> 1  2  7  11   2327
> >> 2  7 11  13    179
> >>
> >> We could of course come up with a routine which does something similar
> >> for other examples (but we will run into prohibitive resource
> >> limitations if we allow large enough integers).
> >>
> >> So... just to confirm... this is the problem we are trying to solve?
> >>
> >> Thanks,
> >>
> >> --
> >> Raul
> >>
> >>
> >>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to