Yes I meant the digits.
I'm a little confused about the output I'm getting. Here's what I've got:
cd
4 : 'x -:&:(/:~)&:(10&#.^:_1) y'"0
f
+/&({. cd/ ])
f0
1 2 3 4 5 6&*"0
When I do 'f f0 1 2 3' I want a rank-1 list, but I'm getting a rank-2 array.
f f0 1
1
f f0 1 2 3
1 1 1 1 1 1
1 1 1 0 0 0
1 1 0 0 0 0
Based on the first output I was expecting '1 1 1' for the second. I'm guessing
I need to assign one or more of the verbs with a different rank, but I can't
see what exactly to do.
On 22 Sep 2011, at 22:53, Henry Rich wrote:
> The digits, you mean?
>
> -:&:(/:~)&:(10&#.^:_1)"0
>
> would be one way. Is 35 a permutation of 503?
>
> Henry Rich
>
> On 9/22/2011 5:41 PM, David Vaughan wrote:
>> Hi, what is the best (fastest) way to check whether a number is a
>> permutation of another number?
>> I've tried listing all permutations of one number and checking whether the
>> other number is in the list of permutations. This seems pretty slow, so I
>> was hoping for a faster method.
>>
>> Thanks.
>> ----------------------------------------------------------------------
>> 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