# Rhythmic canons modulus p (4)

I had some time recently to play with rhythmic canons, which we have previously seen here.

In particular, I had been calculating the length of rhythmic canons mod 2 based on the motive {0,1,N}. It seems that Hélianthe and I have found a way to calculate the length for any N without actually having to calculate the entries of the canon. So, whereas before I would have to wait a couple of weeks to get the length for N>45, I could now get it in a matter of seconds.

And voilà ! The length of canons mod 2 for N up to 150.

We can see the specific cases studied by Hélianthe for $N=2^k$ and $N=2^k+1$. There are a couple of interesting things as well: for example, what is going on for N=73, or N=85 ? (I have no idea…)

But the cool thing is that our method seems to work for any modulus $p$, and not necessarily $p=2$. Remember from this post that I began calculating the lengths for $p=3$. Well, here it is for $p=5$.

As in the case $p=2$, we seem to have an interesting situation for $N=5^k$, and $N=5^k+1$.

In fact, I conjecture that for any $p$ different than 3, the length of the canon based on the motive {0,1,p^k} would be $p^{2k}-1$. For $p=3$, as already discussed in the previous post, it would be $3*(3^{2k}-1)$.

Also, you’ll recall that Hélianthe found a very nice description of the entries of the canons mod 2 when $N=2^k$, by organizing them in a $N-1 \times N$ table, and putting a 1 at the cell $(i,j)$ if the canon has an entry at $N*i+j$ (and else a zero). So, for example with $N=64$, we get this table (white is 1, black is 0):

and for $N=128$, we get this table:

and you can clearly see the recursivity between these tables.

For $p>2$, the canons are not compact (i.e. there may be more than one entry of the motive {0,1,N} on a given beat), but we can still construct these tables, by putting in each cell the corresponding number of entries (between 0 and p-1).

So for example, with $p=5$ and $N=25$, we get this table (black is still 0, white is 4):

and with $N=125$:

(Update: ah, what the heck, let’s do it for $N=625$ as well :) :

Finally, for $p=7$ and $N=49$, we get the following table:

and for $N=343$, we get:

Exciting, isn’t it ? :)