Watching this, I got to thinking about your anagram index of the "by suit" deck.

We know that an anagram index is in some sense based on the factorial
of the length of the sequence.

But, also, we can use the indices of the sequence as a base for the
anagram index, if we toss the 0 and 1. For example:

   ((i.!4)A.i.4),._,.(_2}.i.-4)#:i.!4
0 1 2 3 _ 0 0
0 1 3 2 _ 0 1
0 2 1 3 _ 1 0
0 2 3 1 _ 1 1
0 3 1 2 _ 2 0
0 3 2 1 _ 2 1
1 0 2 3 _ 0 0
1 0 3 2 _ 0 1
1 2 0 3 _ 1 0
1 2 3 0 _ 1 1
1 3 0 2 _ 2 0
1 3 2 0 _ 2 1
2 0 1 3 _ 0 0
2 0 3 1 _ 0 1
2 1 0 3 _ 1 0
2 1 3 0 _ 1 1
2 3 0 1 _ 2 0
2 3 1 0 _ 2 1
3 0 1 2 _ 0 0
3 0 2 1 _ 0 1
3 1 0 2 _ 1 0
3 1 2 0 _ 1 1
3 2 0 1 _ 2 0
3 2 1 0 _ 2 1

We can see here that the swaps in the permutations (the numbers on the
left) correspond in some way to the "anagram index in base 0 1-.~i.-#"
(the numbers on the right). Here, I guess we ignore the leftmost and
rightmost values in the permutation, since they are fully determined,
in the sense of swaps, by the other values.

So, now we have a way of looking at the anagram index of the
transposed deck of cards:

   (_2}.i.-52)#:A.,|:i.4 13
12 24 36 0 11 22 33 0 10 20 30 0 9 18 27 0 8 16 24 0 7 14 21 0 6 12 18
0 5 10 15 0 4 8 12 0 3 6 9 0 2 4 6 0 1 2 3 0 0 0

At first, the pattern there doesn't really leap out at us. But, after
a short look, it's obvious that these numbers occur in sequences of
four. So:

   _4]\(_2}.i.-52)#:A.,|:i.4 13
12 24 36 0
11 22 33 0
10 20 30 0
 9 18 27 0
 8 16 24 0
 7 14 21 0
 6 12 18 0
 5 10 15 0
 4  8 12 0
 3  6  9 0
 2  4  6 0
 1  2  3 0

In other words, it's:

   _2}.,(i._13) */ 1|.i.4
12 24 36 0 11 22 33 0 10 20 30 0 9 18 27 0 8 16 24 0 7 14 21 0 6 12 18
0 5 10 15 0 4 8 12 0 3 6 9 0 2 4 6 0 1 2 3 0 0 0

Now... I should probably do some more experiments here, to see if I
could form a more general insight into how we might compute an
arbitrary anagram index. But there's definitely a pattern here, and
someone with a stronger background in permutations might be able to
describe some useful techniques.

Thanks,

-- 
Raul

On Sun, Mar 13, 2022 at 5:22 PM Michal Wallace <[email protected]> wrote:
>
> I made a short beginner video about dealing cards, using ? and A. :
>
> https://www.youtube.com/watch?v=eXGKK8BkCkg
> ----------------------------------------------------------------------
> 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