Vigenere ciphers : Need help for math analysis
First, you decrypt the first four characters. The plaintext you find is the key for the next block of four characters, so after this you can decrypt the next block, finding the key for the block after that, and so on.

This means you will need a case distinction: one case for the first $|K|$  characters (where $|\dots| \stackrel{\text{def}}{=} \text{the length of $\cdots$}$), and one case for the rest of the text. Mathematically, you could write this down as follows:

$$C_i = \begin{cases}i &lt; |K| &amp; M_i + K_i \pmod{26}\\
i \geq |K| &amp; M_i + M_{i - |K|} \pmod{26}\end{cases}$$

For $i&lt;|K|$ we take the standard Vigenère formula. For the rest, you take the ciphertext one keylength back as key. Note that my formula assumes you start with $i=0$; if you start with $i=1$ you'll need $\le$ and $&gt;$ instead.

Then, decryption is done similarly:

$$M_i = \begin{cases}i &lt; |K| &amp; C_i - K_i \pmod{26}\\
i \geq |K| &amp; C_i - M_{i - |K|} \pmod{26}\end{cases}$$