[Jprogramming] Partitions

Linda Alvord lindaalvord at verizon.net
Fri Oct 20 06:33:44 UTC 2017





Here is a different comb verb and I removed 1+ from he end of par3.

 

load 'stats'

  comb
4 : 0
k=. i.>:d=. y-x
z=. (d$<i.0 0),<i.1 0
for. i.x do. z=. k ,.&.> ,&.>/\. >:&.> z end.
; z
par =: 2 (}. i.)&.>/\"1 0: ,. (comb&.<:) ,. ]


comb2=: 13 :'(x=+/"1 #:i.2^y) ([:|.[:I.#) #:i.2^y'

par2 =: 2 (}. i.)&.>/\"1 0: ,. (comb2&.<:) ,. ]

(3 par 5)-:3 par2 5

1

par3=: 4 : '(1,.2</\"1(i.x)#/~(y=+/"1 o)#o=.((x$v)#:i.v^x){1+i.v=.1+ y-x)<;.1[i.y'

(3 par 5)-:3 par3 5

1

 

Linda

 


Sent from AOL Mobile Mail

Q

> answer (number of permutations of 3 suitable factors), or 6 (number of
>
> combinations of same)?
>
>
> Mike
>
>
>
> ​​
>>
>>
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list