Ah, they are after the combinations that contain 5. Here's a version
that does that.
comb =. ,.(</.~ {.@{.@>) (</.~ /:~"1)1+5 5 5 #: i. 5^3
comb =. ((,~ #&(<,:4#' '))&.> i.@#) ({.@":"0,.',;'{~5 e.{.)L:0 comb
; <@(,&LF)@(#~ +./\.@:~:&' ')"1 ; }:"1@:(,.&:>/)@:({.&.>~ [:>./#@>)&.> comb
111,112,113,114,115;122,123,124,125;133,134,135;144,145;155
121,131,141,151;212,132,142,152;313,143,153;414,154;515
211,311,411,511;221,213,214,215;331,314,315;441,415;551
231,241,251; 341,351; 451;
312,412,512; 413,513; 514;
321,421,521; 431,531; 541;
222,223,224,225;233,234,235;244,245;255
232,242,252;323,243,253;424,254;525
322,422,522;332,324,325;442,425;552
342,352; 452;
423,523; 524;
432,532; 542;
333,334,335;344,345;355
343,353;434,354;535
433,533;443,435;553
453;
534;
543;
444,445;455
454;545
544;554
555
The version you gave has a semicolon in the last row. I think that is a
mistake since it is not consistent with the other rows.
Marshall
On Thu, Aug 08, 2013 at 04:49:57PM -0400, Marshall Lochbaum wrote:
> I don't know how the semicolons are placed, but this code formats Raul's
> output to give the shape you showed with only commas.
>
> comb =. ,.(</.~ {.@{.@>) (</.~ /:~"1)1+5 5 5 #: i. 5^3
> comb =. ((,~ #&(<,:4#' '))&.> i.@#) (',',.~{.@":"0)L:0 comb
> ; ,&LF&.> <@({.~i:&',')"1 ; ,.&:>/@:({.&.>~ [:>./#@>)&.> comb
> 111,112,113,114,115,122,123,124,125,133,134,135,144,145,155
> 121,131,141,151,212,132,142,152,313,143,153,414,154,515
> 211,311,411,511,221,213,214,215,331,314,315,441,415,551
> 231,241,251, 341,351, 451
> 312,412,512, 413,513, 514
> 321,421,521, 431,531, 541
> 222,223,224,225,233,234,235,244,245,255
> 232,242,252,323,243,253,424,254,525
> 322,422,522,332,324,325,442,425,552
> 342,352, 452
> 423,523, 524
> 432,532, 542
> 333,334,335,344,345,355
> 343,353,434,354,535
> 433,533,443,435,553
> 453
> 534
> 543
> 444,445,455
> 454,545
> 544,554
> 555
>
> Marshall
>
> On Thu, Aug 08, 2013 at 03:34:32PM -0400, Raul Miller wrote:
> > If I ignore formatting issues, this gives the basic structure:
> >
> > ,.(</.~ {.@{.@>) (</.~ /:~"1)1+5 5 5 #: i. 5^3
> >
> > FYI,
> >
> > --
> > Raul
> >
> > On Thu, Aug 8, 2013 at 3:29 PM, Atto Ampere <[email protected]> wrote:
> > > I came across this chart in an 200 year old publication..
> > > and was wasting my time figuring out by hand the laws by which it is
> > > governed just because i couldn't use J, which seems a perfect fit for
> > > it!
> > >
> > >
> > >
> > > 111,112,113,114,115;122,123,124,125;133,134,135;144,145;155
> > > 121,131,141,151;212,132,142,152;313,143,153;414,154;515
> > > 211,311,411,511;221,213,214,215;331,314,315;441,415;551
> > > 231,241,251; 341,351; 451;
> > > 312,412,512; 413,513; 514;
> > > 321,421,521; 431,531; 541;
> > > 222,223,224,225;233,234,235;244,245;255
> > > 232,242,252;323,243,253;424,254;525
> > > 322,422,522;332,324,325;442,425;552
> > > 342,352; 452;
> > > 423,523; 524;
> > > 432,532; 542;
> > > 333,334,335;344,345;355
> > > 343,353;434,354;535
> > > 433,533;443,435;553
> > > 453;
> > > 534;
> > > 543;
> > > 444,445;455
> > > 454;545
> > > 544;554
> > > 555;
> > >
> > > it's just the combinations with repetitions of 3 out of 5 elements in
> > > lexicographic order, with the permutations written below the cases.
> > >
> > >
> > > 1 3 3 3 3 3 3|3 6 6 6 6 6 3 6 6 6 6 3 6 6 6 3 6 6 3 6 3 ... 7 [28]
> > > (3 out of 7 elements)
> > > 7
> > > 1 3 3 3 3 3|3 6 6 6 6 3 6 6 6 3 6 6 3 6 3 ... 6 [21]
> > > (3 out of 6 elements)
> > > 6
> > > 1 3 3 3 3|3 6 6 6 3 6 6 3 6 3 Multinomial coefficient 5 [15] (3
> > > out of 5 elements)
> > > 5
> > > 1 3 3 3|3 6 6 3 6 3 follows Pascal Simplex [10] (3
> > > out
> > > of 4 elements)
> > > 4
> > > 1 3 3|3 6 3 follows Pascal's Tetrahedron(last row excl.)[6]
> > > (3 out of 3 elements)
> > > 3
> > > 1 3|3 follows Pascal's Triangle [3] (3
> > > out of 2 elements)
> > > 2
> > > 1 [1] (3
> > > out of 1 element)
> > >
> > >
> > > number of combinations beginning with the 1st element - triangular numbers
> > > picking 4 elements with repetition would be governed by tetrahedral
> > > numbers
> > > and so on
> > >
> > > HOW COULD ONE GENERATE ALL THIS IN J??
> > > thanks in advance
> > > atto
> > >
> > >
> > >
> > > Lexicographic Multiset Permutation Generation including Ranking etc.
> > > A New Method for Generating Permutations in Lexicographic Order
> > > http://203.72.2.115/Ejournal/AL03050402.pdf
> > > From Permutations to Iterative Permutations
> > > http://www.ijcset.net/docs/Volumes/volume2issue7/ijcset2012020702.pdf
> > > ----------------------------------------------------------------------
> > > 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