(#~ (+: |.!.0)@([: >/\. 0 ,~ 0 = 2&(+/\)))^:_ ] 1 _1 2 _2{~100?.@#4
2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2 _2 _2
_2 _1 _2 _1 _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2
Henry Rich
On 12/6/2019 2:24 PM, Raul Miller wrote:
Here's one approach:
an0=: 2#0~:_2 +/\ ]
an1=: ({.,(#~ an0)@}.@}:,{:)@(#~ an0)
an2=: an1^:_
an2 1 _1 2 _2{~100?.@#4
2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2 _2
_2 _2 _1 _2 _1 _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2
#an2 1 _1 2 _2{~100?.@#4
50
I have not convinced myself that there's no ambiguity in this problem,
and my approach seems like it has room for improvement, but I get the
same result you got.
Thanks,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm