#nullable enable
using System;
using System.Globalization;
using System.Linq;
// CITE — d'après enumerate_records.py (chain-theory, CC BY 4.0) et table I de la Letter ; données saisies, non recalculées ici.
//
// Les 172 enregistrements sont SAISIS : transcription de la sortie de l'énumération du carnet Python
// (lui-même adaptation narrée du script annexe de la Letter), dans son ordre. Ce carnet ne les
// reconstruit pas : il les contrôle ici, puis les compte (cellule suivante).
// Une ligne = un enregistrement :
// genre : 0 = fixe, 1 = impair, 2 = pair, 3 = commutateur
// memeGenre : 1 si toutes les lettres vivent sur le même genre de slot (qutrit-qutrit ou qubit-qubit), 0 sinon
// nbTermes : nombre de termes de la combinaison
// puis, pour chaque terme : nbLettres, puis (slot, lettre) pour chaque lettre, puis le coefficient
// slot 1 = Q1, 3 = Q2 (copies du qutrit, 8 lettres) ; slot 2 = q1, 4 = q2 (qubits, 3 lettres).
int[][] enregistrementsC16 = new int[][]
{
new[] { 1, 0, 2, 2, 1, 0, 2, 0, 1, 2, 3, 0, 4, 0, -1 }, // impair : [1,0][2,0]: +1 | [3,0][4,0]: -1
new[] { 2, 0, 2, 2, 1, 0, 2, 0, 1, 2, 3, 0, 4, 0, 1 }, // pair : [1,0][2,0]: +1 | [3,0][4,0]: +1
new[] { 1, 0, 2, 2, 1, 0, 2, 1, 1, 2, 3, 0, 4, 1, -1 }, // impair : [1,0][2,1]: +1 | [3,0][4,1]: -1
new[] { 2, 0, 2, 2, 1, 0, 2, 1, 1, 2, 3, 0, 4, 1, 1 }, // pair : [1,0][2,1]: +1 | [3,0][4,1]: +1
new[] { 1, 0, 2, 2, 1, 0, 2, 2, 1, 2, 3, 0, 4, 2, -1 }, // impair : [1,0][2,2]: +1 | [3,0][4,2]: -1
new[] { 2, 0, 2, 2, 1, 0, 2, 2, 1, 2, 3, 0, 4, 2, 1 }, // pair : [1,0][2,2]: +1 | [3,0][4,2]: +1
new[] { 1, 0, 2, 2, 1, 1, 2, 0, 1, 2, 3, 1, 4, 0, -1 }, // impair : [1,1][2,0]: +1 | [3,1][4,0]: -1
new[] { 2, 0, 2, 2, 1, 1, 2, 0, 1, 2, 3, 1, 4, 0, 1 }, // pair : [1,1][2,0]: +1 | [3,1][4,0]: +1
new[] { 1, 0, 2, 2, 1, 1, 2, 1, 1, 2, 3, 1, 4, 1, -1 }, // impair : [1,1][2,1]: +1 | [3,1][4,1]: -1
new[] { 2, 0, 2, 2, 1, 1, 2, 1, 1, 2, 3, 1, 4, 1, 1 }, // pair : [1,1][2,1]: +1 | [3,1][4,1]: +1
new[] { 1, 0, 2, 2, 1, 1, 2, 2, 1, 2, 3, 1, 4, 2, -1 }, // impair : [1,1][2,2]: +1 | [3,1][4,2]: -1
new[] { 2, 0, 2, 2, 1, 1, 2, 2, 1, 2, 3, 1, 4, 2, 1 }, // pair : [1,1][2,2]: +1 | [3,1][4,2]: +1
new[] { 1, 0, 2, 2, 1, 2, 2, 0, 1, 2, 3, 2, 4, 0, -1 }, // impair : [1,2][2,0]: +1 | [3,2][4,0]: -1
new[] { 2, 0, 2, 2, 1, 2, 2, 0, 1, 2, 3, 2, 4, 0, 1 }, // pair : [1,2][2,0]: +1 | [3,2][4,0]: +1
new[] { 1, 0, 2, 2, 1, 2, 2, 1, 1, 2, 3, 2, 4, 1, -1 }, // impair : [1,2][2,1]: +1 | [3,2][4,1]: -1
new[] { 2, 0, 2, 2, 1, 2, 2, 1, 1, 2, 3, 2, 4, 1, 1 }, // pair : [1,2][2,1]: +1 | [3,2][4,1]: +1
new[] { 1, 0, 2, 2, 1, 2, 2, 2, 1, 2, 3, 2, 4, 2, -1 }, // impair : [1,2][2,2]: +1 | [3,2][4,2]: -1
new[] { 2, 0, 2, 2, 1, 2, 2, 2, 1, 2, 3, 2, 4, 2, 1 }, // pair : [1,2][2,2]: +1 | [3,2][4,2]: +1
new[] { 1, 0, 2, 2, 1, 3, 2, 0, 1, 2, 3, 3, 4, 0, -1 }, // impair : [1,3][2,0]: +1 | [3,3][4,0]: -1
new[] { 2, 0, 2, 2, 1, 3, 2, 0, 1, 2, 3, 3, 4, 0, 1 }, // pair : [1,3][2,0]: +1 | [3,3][4,0]: +1
new[] { 1, 0, 2, 2, 1, 3, 2, 1, 1, 2, 3, 3, 4, 1, -1 }, // impair : [1,3][2,1]: +1 | [3,3][4,1]: -1
new[] { 2, 0, 2, 2, 1, 3, 2, 1, 1, 2, 3, 3, 4, 1, 1 }, // pair : [1,3][2,1]: +1 | [3,3][4,1]: +1
new[] { 1, 0, 2, 2, 1, 3, 2, 2, 1, 2, 3, 3, 4, 2, -1 }, // impair : [1,3][2,2]: +1 | [3,3][4,2]: -1
new[] { 2, 0, 2, 2, 1, 3, 2, 2, 1, 2, 3, 3, 4, 2, 1 }, // pair : [1,3][2,2]: +1 | [3,3][4,2]: +1
new[] { 1, 0, 2, 2, 1, 4, 2, 0, 1, 2, 3, 4, 4, 0, -1 }, // impair : [1,4][2,0]: +1 | [3,4][4,0]: -1
new[] { 2, 0, 2, 2, 1, 4, 2, 0, 1, 2, 3, 4, 4, 0, 1 }, // pair : [1,4][2,0]: +1 | [3,4][4,0]: +1
new[] { 1, 0, 2, 2, 1, 4, 2, 1, 1, 2, 3, 4, 4, 1, -1 }, // impair : [1,4][2,1]: +1 | [3,4][4,1]: -1
new[] { 2, 0, 2, 2, 1, 4, 2, 1, 1, 2, 3, 4, 4, 1, 1 }, // pair : [1,4][2,1]: +1 | [3,4][4,1]: +1
new[] { 1, 0, 2, 2, 1, 4, 2, 2, 1, 2, 3, 4, 4, 2, -1 }, // impair : [1,4][2,2]: +1 | [3,4][4,2]: -1
new[] { 2, 0, 2, 2, 1, 4, 2, 2, 1, 2, 3, 4, 4, 2, 1 }, // pair : [1,4][2,2]: +1 | [3,4][4,2]: +1
new[] { 1, 0, 2, 2, 1, 5, 2, 0, 1, 2, 3, 5, 4, 0, -1 }, // impair : [1,5][2,0]: +1 | [3,5][4,0]: -1
new[] { 2, 0, 2, 2, 1, 5, 2, 0, 1, 2, 3, 5, 4, 0, 1 }, // pair : [1,5][2,0]: +1 | [3,5][4,0]: +1
new[] { 1, 0, 2, 2, 1, 5, 2, 1, 1, 2, 3, 5, 4, 1, -1 }, // impair : [1,5][2,1]: +1 | [3,5][4,1]: -1
new[] { 2, 0, 2, 2, 1, 5, 2, 1, 1, 2, 3, 5, 4, 1, 1 }, // pair : [1,5][2,1]: +1 | [3,5][4,1]: +1
new[] { 1, 0, 2, 2, 1, 5, 2, 2, 1, 2, 3, 5, 4, 2, -1 }, // impair : [1,5][2,2]: +1 | [3,5][4,2]: -1
new[] { 2, 0, 2, 2, 1, 5, 2, 2, 1, 2, 3, 5, 4, 2, 1 }, // pair : [1,5][2,2]: +1 | [3,5][4,2]: +1
new[] { 1, 0, 2, 2, 1, 6, 2, 0, 1, 2, 3, 6, 4, 0, -1 }, // impair : [1,6][2,0]: +1 | [3,6][4,0]: -1
new[] { 2, 0, 2, 2, 1, 6, 2, 0, 1, 2, 3, 6, 4, 0, 1 }, // pair : [1,6][2,0]: +1 | [3,6][4,0]: +1
new[] { 1, 0, 2, 2, 1, 6, 2, 1, 1, 2, 3, 6, 4, 1, -1 }, // impair : [1,6][2,1]: +1 | [3,6][4,1]: -1
new[] { 2, 0, 2, 2, 1, 6, 2, 1, 1, 2, 3, 6, 4, 1, 1 }, // pair : [1,6][2,1]: +1 | [3,6][4,1]: +1
new[] { 1, 0, 2, 2, 1, 6, 2, 2, 1, 2, 3, 6, 4, 2, -1 }, // impair : [1,6][2,2]: +1 | [3,6][4,2]: -1
new[] { 2, 0, 2, 2, 1, 6, 2, 2, 1, 2, 3, 6, 4, 2, 1 }, // pair : [1,6][2,2]: +1 | [3,6][4,2]: +1
new[] { 1, 0, 2, 2, 1, 7, 2, 0, 1, 2, 3, 7, 4, 0, -1 }, // impair : [1,7][2,0]: +1 | [3,7][4,0]: -1
new[] { 2, 0, 2, 2, 1, 7, 2, 0, 1, 2, 3, 7, 4, 0, 1 }, // pair : [1,7][2,0]: +1 | [3,7][4,0]: +1
new[] { 1, 0, 2, 2, 1, 7, 2, 1, 1, 2, 3, 7, 4, 1, -1 }, // impair : [1,7][2,1]: +1 | [3,7][4,1]: -1
new[] { 2, 0, 2, 2, 1, 7, 2, 1, 1, 2, 3, 7, 4, 1, 1 }, // pair : [1,7][2,1]: +1 | [3,7][4,1]: +1
new[] { 1, 0, 2, 2, 1, 7, 2, 2, 1, 2, 3, 7, 4, 2, -1 }, // impair : [1,7][2,2]: +1 | [3,7][4,2]: -1
new[] { 2, 0, 2, 2, 1, 7, 2, 2, 1, 2, 3, 7, 4, 2, 1 }, // pair : [1,7][2,2]: +1 | [3,7][4,2]: +1
new[] { 0, 1, 1, 2, 1, 0, 3, 0, 1 }, // fixe : [1,0][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 1, 1, 2, 1, 1, 3, 0, -1 }, // impair : [1,0][3,1]: +1 | [1,1][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 1, 1, 2, 1, 1, 3, 0, 1 }, // pair : [1,0][3,1]: +1 | [1,1][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 2, 1, 2, 1, 2, 3, 0, -1 }, // impair : [1,0][3,2]: +1 | [1,2][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 2, 1, 2, 1, 2, 3, 0, 1 }, // pair : [1,0][3,2]: +1 | [1,2][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 3, 1, 2, 1, 3, 3, 0, -1 }, // impair : [1,0][3,3]: +1 | [1,3][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 3, 1, 2, 1, 3, 3, 0, 1 }, // pair : [1,0][3,3]: +1 | [1,3][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 4, 1, 2, 1, 4, 3, 0, -1 }, // impair : [1,0][3,4]: +1 | [1,4][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 4, 1, 2, 1, 4, 3, 0, 1 }, // pair : [1,0][3,4]: +1 | [1,4][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 5, 1, 2, 1, 5, 3, 0, -1 }, // impair : [1,0][3,5]: +1 | [1,5][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 5, 1, 2, 1, 5, 3, 0, 1 }, // pair : [1,0][3,5]: +1 | [1,5][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 6, 1, 2, 1, 6, 3, 0, -1 }, // impair : [1,0][3,6]: +1 | [1,6][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 6, 1, 2, 1, 6, 3, 0, 1 }, // pair : [1,0][3,6]: +1 | [1,6][3,0]: +1
new[] { 1, 1, 2, 2, 1, 0, 3, 7, 1, 2, 1, 7, 3, 0, -1 }, // impair : [1,0][3,7]: +1 | [1,7][3,0]: -1
new[] { 2, 1, 2, 2, 1, 0, 3, 7, 1, 2, 1, 7, 3, 0, 1 }, // pair : [1,0][3,7]: +1 | [1,7][3,0]: +1
new[] { 0, 1, 1, 2, 1, 1, 3, 1, 1 }, // fixe : [1,1][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 2, 1, 2, 1, 2, 3, 1, -1 }, // impair : [1,1][3,2]: +1 | [1,2][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 2, 1, 2, 1, 2, 3, 1, 1 }, // pair : [1,1][3,2]: +1 | [1,2][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 3, 1, 2, 1, 3, 3, 1, -1 }, // impair : [1,1][3,3]: +1 | [1,3][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 3, 1, 2, 1, 3, 3, 1, 1 }, // pair : [1,1][3,3]: +1 | [1,3][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 4, 1, 2, 1, 4, 3, 1, -1 }, // impair : [1,1][3,4]: +1 | [1,4][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 4, 1, 2, 1, 4, 3, 1, 1 }, // pair : [1,1][3,4]: +1 | [1,4][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 5, 1, 2, 1, 5, 3, 1, -1 }, // impair : [1,1][3,5]: +1 | [1,5][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 5, 1, 2, 1, 5, 3, 1, 1 }, // pair : [1,1][3,5]: +1 | [1,5][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 6, 1, 2, 1, 6, 3, 1, -1 }, // impair : [1,1][3,6]: +1 | [1,6][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 6, 1, 2, 1, 6, 3, 1, 1 }, // pair : [1,1][3,6]: +1 | [1,6][3,1]: +1
new[] { 1, 1, 2, 2, 1, 1, 3, 7, 1, 2, 1, 7, 3, 1, -1 }, // impair : [1,1][3,7]: +1 | [1,7][3,1]: -1
new[] { 2, 1, 2, 2, 1, 1, 3, 7, 1, 2, 1, 7, 3, 1, 1 }, // pair : [1,1][3,7]: +1 | [1,7][3,1]: +1
new[] { 0, 1, 1, 2, 1, 2, 3, 2, 1 }, // fixe : [1,2][3,2]: +1
new[] { 1, 1, 2, 2, 1, 2, 3, 3, 1, 2, 1, 3, 3, 2, -1 }, // impair : [1,2][3,3]: +1 | [1,3][3,2]: -1
new[] { 2, 1, 2, 2, 1, 2, 3, 3, 1, 2, 1, 3, 3, 2, 1 }, // pair : [1,2][3,3]: +1 | [1,3][3,2]: +1
new[] { 1, 1, 2, 2, 1, 2, 3, 4, 1, 2, 1, 4, 3, 2, -1 }, // impair : [1,2][3,4]: +1 | [1,4][3,2]: -1
new[] { 2, 1, 2, 2, 1, 2, 3, 4, 1, 2, 1, 4, 3, 2, 1 }, // pair : [1,2][3,4]: +1 | [1,4][3,2]: +1
new[] { 1, 1, 2, 2, 1, 2, 3, 5, 1, 2, 1, 5, 3, 2, -1 }, // impair : [1,2][3,5]: +1 | [1,5][3,2]: -1
new[] { 2, 1, 2, 2, 1, 2, 3, 5, 1, 2, 1, 5, 3, 2, 1 }, // pair : [1,2][3,5]: +1 | [1,5][3,2]: +1
new[] { 1, 1, 2, 2, 1, 2, 3, 6, 1, 2, 1, 6, 3, 2, -1 }, // impair : [1,2][3,6]: +1 | [1,6][3,2]: -1
new[] { 2, 1, 2, 2, 1, 2, 3, 6, 1, 2, 1, 6, 3, 2, 1 }, // pair : [1,2][3,6]: +1 | [1,6][3,2]: +1
new[] { 1, 1, 2, 2, 1, 2, 3, 7, 1, 2, 1, 7, 3, 2, -1 }, // impair : [1,2][3,7]: +1 | [1,7][3,2]: -1
new[] { 2, 1, 2, 2, 1, 2, 3, 7, 1, 2, 1, 7, 3, 2, 1 }, // pair : [1,2][3,7]: +1 | [1,7][3,2]: +1
new[] { 0, 1, 1, 2, 1, 3, 3, 3, 1 }, // fixe : [1,3][3,3]: +1
new[] { 1, 1, 2, 2, 1, 3, 3, 4, 1, 2, 1, 4, 3, 3, -1 }, // impair : [1,3][3,4]: +1 | [1,4][3,3]: -1
new[] { 2, 1, 2, 2, 1, 3, 3, 4, 1, 2, 1, 4, 3, 3, 1 }, // pair : [1,3][3,4]: +1 | [1,4][3,3]: +1
new[] { 1, 1, 2, 2, 1, 3, 3, 5, 1, 2, 1, 5, 3, 3, -1 }, // impair : [1,3][3,5]: +1 | [1,5][3,3]: -1
new[] { 2, 1, 2, 2, 1, 3, 3, 5, 1, 2, 1, 5, 3, 3, 1 }, // pair : [1,3][3,5]: +1 | [1,5][3,3]: +1
new[] { 1, 1, 2, 2, 1, 3, 3, 6, 1, 2, 1, 6, 3, 3, -1 }, // impair : [1,3][3,6]: +1 | [1,6][3,3]: -1
new[] { 2, 1, 2, 2, 1, 3, 3, 6, 1, 2, 1, 6, 3, 3, 1 }, // pair : [1,3][3,6]: +1 | [1,6][3,3]: +1
new[] { 1, 1, 2, 2, 1, 3, 3, 7, 1, 2, 1, 7, 3, 3, -1 }, // impair : [1,3][3,7]: +1 | [1,7][3,3]: -1
new[] { 2, 1, 2, 2, 1, 3, 3, 7, 1, 2, 1, 7, 3, 3, 1 }, // pair : [1,3][3,7]: +1 | [1,7][3,3]: +1
new[] { 0, 1, 1, 2, 1, 4, 3, 4, 1 }, // fixe : [1,4][3,4]: +1
new[] { 1, 1, 2, 2, 1, 4, 3, 5, 1, 2, 1, 5, 3, 4, -1 }, // impair : [1,4][3,5]: +1 | [1,5][3,4]: -1
new[] { 2, 1, 2, 2, 1, 4, 3, 5, 1, 2, 1, 5, 3, 4, 1 }, // pair : [1,4][3,5]: +1 | [1,5][3,4]: +1
new[] { 1, 1, 2, 2, 1, 4, 3, 6, 1, 2, 1, 6, 3, 4, -1 }, // impair : [1,4][3,6]: +1 | [1,6][3,4]: -1
new[] { 2, 1, 2, 2, 1, 4, 3, 6, 1, 2, 1, 6, 3, 4, 1 }, // pair : [1,4][3,6]: +1 | [1,6][3,4]: +1
new[] { 1, 1, 2, 2, 1, 4, 3, 7, 1, 2, 1, 7, 3, 4, -1 }, // impair : [1,4][3,7]: +1 | [1,7][3,4]: -1
new[] { 2, 1, 2, 2, 1, 4, 3, 7, 1, 2, 1, 7, 3, 4, 1 }, // pair : [1,4][3,7]: +1 | [1,7][3,4]: +1
new[] { 0, 1, 1, 2, 1, 5, 3, 5, 1 }, // fixe : [1,5][3,5]: +1
new[] { 1, 1, 2, 2, 1, 5, 3, 6, 1, 2, 1, 6, 3, 5, -1 }, // impair : [1,5][3,6]: +1 | [1,6][3,5]: -1
new[] { 2, 1, 2, 2, 1, 5, 3, 6, 1, 2, 1, 6, 3, 5, 1 }, // pair : [1,5][3,6]: +1 | [1,6][3,5]: +1
new[] { 1, 1, 2, 2, 1, 5, 3, 7, 1, 2, 1, 7, 3, 5, -1 }, // impair : [1,5][3,7]: +1 | [1,7][3,5]: -1
new[] { 2, 1, 2, 2, 1, 5, 3, 7, 1, 2, 1, 7, 3, 5, 1 }, // pair : [1,5][3,7]: +1 | [1,7][3,5]: +1
new[] { 0, 1, 1, 2, 1, 6, 3, 6, 1 }, // fixe : [1,6][3,6]: +1
new[] { 1, 1, 2, 2, 1, 6, 3, 7, 1, 2, 1, 7, 3, 6, -1 }, // impair : [1,6][3,7]: +1 | [1,7][3,6]: -1
new[] { 2, 1, 2, 2, 1, 6, 3, 7, 1, 2, 1, 7, 3, 6, 1 }, // pair : [1,6][3,7]: +1 | [1,7][3,6]: +1
new[] { 0, 1, 1, 2, 1, 7, 3, 7, 1 }, // fixe : [1,7][3,7]: +1
new[] { 1, 0, 2, 2, 1, 0, 4, 0, 1, 2, 2, 0, 3, 0, -1 }, // impair : [1,0][4,0]: +1 | [2,0][3,0]: -1
new[] { 2, 0, 2, 2, 1, 0, 4, 0, 1, 2, 2, 0, 3, 0, 1 }, // pair : [1,0][4,0]: +1 | [2,0][3,0]: +1
new[] { 1, 0, 2, 2, 1, 0, 4, 1, 1, 2, 2, 1, 3, 0, -1 }, // impair : [1,0][4,1]: +1 | [2,1][3,0]: -1
new[] { 2, 0, 2, 2, 1, 0, 4, 1, 1, 2, 2, 1, 3, 0, 1 }, // pair : [1,0][4,1]: +1 | [2,1][3,0]: +1
new[] { 1, 0, 2, 2, 1, 0, 4, 2, 1, 2, 2, 2, 3, 0, -1 }, // impair : [1,0][4,2]: +1 | [2,2][3,0]: -1
new[] { 2, 0, 2, 2, 1, 0, 4, 2, 1, 2, 2, 2, 3, 0, 1 }, // pair : [1,0][4,2]: +1 | [2,2][3,0]: +1
new[] { 1, 0, 2, 2, 1, 1, 4, 0, 1, 2, 2, 0, 3, 1, -1 }, // impair : [1,1][4,0]: +1 | [2,0][3,1]: -1
new[] { 2, 0, 2, 2, 1, 1, 4, 0, 1, 2, 2, 0, 3, 1, 1 }, // pair : [1,1][4,0]: +1 | [2,0][3,1]: +1
new[] { 1, 0, 2, 2, 1, 1, 4, 1, 1, 2, 2, 1, 3, 1, -1 }, // impair : [1,1][4,1]: +1 | [2,1][3,1]: -1
new[] { 2, 0, 2, 2, 1, 1, 4, 1, 1, 2, 2, 1, 3, 1, 1 }, // pair : [1,1][4,1]: +1 | [2,1][3,1]: +1
new[] { 1, 0, 2, 2, 1, 1, 4, 2, 1, 2, 2, 2, 3, 1, -1 }, // impair : [1,1][4,2]: +1 | [2,2][3,1]: -1
new[] { 2, 0, 2, 2, 1, 1, 4, 2, 1, 2, 2, 2, 3, 1, 1 }, // pair : [1,1][4,2]: +1 | [2,2][3,1]: +1
new[] { 1, 0, 2, 2, 1, 2, 4, 0, 1, 2, 2, 0, 3, 2, -1 }, // impair : [1,2][4,0]: +1 | [2,0][3,2]: -1
new[] { 2, 0, 2, 2, 1, 2, 4, 0, 1, 2, 2, 0, 3, 2, 1 }, // pair : [1,2][4,0]: +1 | [2,0][3,2]: +1
new[] { 1, 0, 2, 2, 1, 2, 4, 1, 1, 2, 2, 1, 3, 2, -1 }, // impair : [1,2][4,1]: +1 | [2,1][3,2]: -1
new[] { 2, 0, 2, 2, 1, 2, 4, 1, 1, 2, 2, 1, 3, 2, 1 }, // pair : [1,2][4,1]: +1 | [2,1][3,2]: +1
new[] { 1, 0, 2, 2, 1, 2, 4, 2, 1, 2, 2, 2, 3, 2, -1 }, // impair : [1,2][4,2]: +1 | [2,2][3,2]: -1
new[] { 2, 0, 2, 2, 1, 2, 4, 2, 1, 2, 2, 2, 3, 2, 1 }, // pair : [1,2][4,2]: +1 | [2,2][3,2]: +1
new[] { 1, 0, 2, 2, 1, 3, 4, 0, 1, 2, 2, 0, 3, 3, -1 }, // impair : [1,3][4,0]: +1 | [2,0][3,3]: -1
new[] { 2, 0, 2, 2, 1, 3, 4, 0, 1, 2, 2, 0, 3, 3, 1 }, // pair : [1,3][4,0]: +1 | [2,0][3,3]: +1
new[] { 1, 0, 2, 2, 1, 3, 4, 1, 1, 2, 2, 1, 3, 3, -1 }, // impair : [1,3][4,1]: +1 | [2,1][3,3]: -1
new[] { 2, 0, 2, 2, 1, 3, 4, 1, 1, 2, 2, 1, 3, 3, 1 }, // pair : [1,3][4,1]: +1 | [2,1][3,3]: +1
new[] { 1, 0, 2, 2, 1, 3, 4, 2, 1, 2, 2, 2, 3, 3, -1 }, // impair : [1,3][4,2]: +1 | [2,2][3,3]: -1
new[] { 2, 0, 2, 2, 1, 3, 4, 2, 1, 2, 2, 2, 3, 3, 1 }, // pair : [1,3][4,2]: +1 | [2,2][3,3]: +1
new[] { 1, 0, 2, 2, 1, 4, 4, 0, 1, 2, 2, 0, 3, 4, -1 }, // impair : [1,4][4,0]: +1 | [2,0][3,4]: -1
new[] { 2, 0, 2, 2, 1, 4, 4, 0, 1, 2, 2, 0, 3, 4, 1 }, // pair : [1,4][4,0]: +1 | [2,0][3,4]: +1
new[] { 1, 0, 2, 2, 1, 4, 4, 1, 1, 2, 2, 1, 3, 4, -1 }, // impair : [1,4][4,1]: +1 | [2,1][3,4]: -1
new[] { 2, 0, 2, 2, 1, 4, 4, 1, 1, 2, 2, 1, 3, 4, 1 }, // pair : [1,4][4,1]: +1 | [2,1][3,4]: +1
new[] { 1, 0, 2, 2, 1, 4, 4, 2, 1, 2, 2, 2, 3, 4, -1 }, // impair : [1,4][4,2]: +1 | [2,2][3,4]: -1
new[] { 2, 0, 2, 2, 1, 4, 4, 2, 1, 2, 2, 2, 3, 4, 1 }, // pair : [1,4][4,2]: +1 | [2,2][3,4]: +1
new[] { 1, 0, 2, 2, 1, 5, 4, 0, 1, 2, 2, 0, 3, 5, -1 }, // impair : [1,5][4,0]: +1 | [2,0][3,5]: -1
new[] { 2, 0, 2, 2, 1, 5, 4, 0, 1, 2, 2, 0, 3, 5, 1 }, // pair : [1,5][4,0]: +1 | [2,0][3,5]: +1
new[] { 1, 0, 2, 2, 1, 5, 4, 1, 1, 2, 2, 1, 3, 5, -1 }, // impair : [1,5][4,1]: +1 | [2,1][3,5]: -1
new[] { 2, 0, 2, 2, 1, 5, 4, 1, 1, 2, 2, 1, 3, 5, 1 }, // pair : [1,5][4,1]: +1 | [2,1][3,5]: +1
new[] { 1, 0, 2, 2, 1, 5, 4, 2, 1, 2, 2, 2, 3, 5, -1 }, // impair : [1,5][4,2]: +1 | [2,2][3,5]: -1
new[] { 2, 0, 2, 2, 1, 5, 4, 2, 1, 2, 2, 2, 3, 5, 1 }, // pair : [1,5][4,2]: +1 | [2,2][3,5]: +1
new[] { 1, 0, 2, 2, 1, 6, 4, 0, 1, 2, 2, 0, 3, 6, -1 }, // impair : [1,6][4,0]: +1 | [2,0][3,6]: -1
new[] { 2, 0, 2, 2, 1, 6, 4, 0, 1, 2, 2, 0, 3, 6, 1 }, // pair : [1,6][4,0]: +1 | [2,0][3,6]: +1
new[] { 1, 0, 2, 2, 1, 6, 4, 1, 1, 2, 2, 1, 3, 6, -1 }, // impair : [1,6][4,1]: +1 | [2,1][3,6]: -1
new[] { 2, 0, 2, 2, 1, 6, 4, 1, 1, 2, 2, 1, 3, 6, 1 }, // pair : [1,6][4,1]: +1 | [2,1][3,6]: +1
new[] { 1, 0, 2, 2, 1, 6, 4, 2, 1, 2, 2, 2, 3, 6, -1 }, // impair : [1,6][4,2]: +1 | [2,2][3,6]: -1
new[] { 2, 0, 2, 2, 1, 6, 4, 2, 1, 2, 2, 2, 3, 6, 1 }, // pair : [1,6][4,2]: +1 | [2,2][3,6]: +1
new[] { 1, 0, 2, 2, 1, 7, 4, 0, 1, 2, 2, 0, 3, 7, -1 }, // impair : [1,7][4,0]: +1 | [2,0][3,7]: -1
new[] { 2, 0, 2, 2, 1, 7, 4, 0, 1, 2, 2, 0, 3, 7, 1 }, // pair : [1,7][4,0]: +1 | [2,0][3,7]: +1
new[] { 1, 0, 2, 2, 1, 7, 4, 1, 1, 2, 2, 1, 3, 7, -1 }, // impair : [1,7][4,1]: +1 | [2,1][3,7]: -1
new[] { 2, 0, 2, 2, 1, 7, 4, 1, 1, 2, 2, 1, 3, 7, 1 }, // pair : [1,7][4,1]: +1 | [2,1][3,7]: +1
new[] { 1, 0, 2, 2, 1, 7, 4, 2, 1, 2, 2, 2, 3, 7, -1 }, // impair : [1,7][4,2]: +1 | [2,2][3,7]: -1
new[] { 2, 0, 2, 2, 1, 7, 4, 2, 1, 2, 2, 2, 3, 7, 1 }, // pair : [1,7][4,2]: +1 | [2,2][3,7]: +1
new[] { 0, 1, 1, 2, 2, 0, 4, 0, 1 }, // fixe : [2,0][4,0]: +1
new[] { 1, 1, 2, 2, 2, 0, 4, 1, 1, 2, 2, 1, 4, 0, -1 }, // impair : [2,0][4,1]: +1 | [2,1][4,0]: -1
new[] { 2, 1, 2, 2, 2, 0, 4, 1, 1, 2, 2, 1, 4, 0, 1 }, // pair : [2,0][4,1]: +1 | [2,1][4,0]: +1
new[] { 1, 1, 2, 2, 2, 0, 4, 2, 1, 2, 2, 2, 4, 0, -1 }, // impair : [2,0][4,2]: +1 | [2,2][4,0]: -1
new[] { 2, 1, 2, 2, 2, 0, 4, 2, 1, 2, 2, 2, 4, 0, 1 }, // pair : [2,0][4,2]: +1 | [2,2][4,0]: +1
new[] { 0, 1, 1, 2, 2, 1, 4, 1, 1 }, // fixe : [2,1][4,1]: +1
new[] { 1, 1, 2, 2, 2, 1, 4, 2, 1, 2, 2, 2, 4, 1, -1 }, // impair : [2,1][4,2]: +1 | [2,2][4,1]: -1
new[] { 2, 1, 2, 2, 2, 1, 4, 2, 1, 2, 2, 2, 4, 1, 1 }, // pair : [2,1][4,2]: +1 | [2,2][4,1]: +1
new[] { 0, 1, 1, 2, 2, 2, 4, 2, 1 }, // fixe : [2,2][4,2]: +1
new[] { 3, 0, 2, 1, 2, 2, -2, 1, 4, 2, 2 }, // commutateur : [2,2]: -2 | [4,2]: +2
new[] { 3, 0, 2, 1, 2, 1, -2, 1, 4, 1, 2 }, // commutateur : [2,1]: -2 | [4,1]: +2
new[] { 3, 0, 2, 1, 2, 0, -2, 1, 4, 0, 2 }, // commutateur : [2,0]: -2 | [4,0]: +2
};
// CONTROLES de la table saisie : rien n'est recalculé, on dénombre et on vérifie la forme de chaque ligne.
int totalC16 = enregistrementsC16.Length;
int nbFixeC16 = enregistrementsC16.Count(enregistrement => enregistrement[0] == 0);
int nbImpairC16 = enregistrementsC16.Count(enregistrement => enregistrement[0] == 1);
int nbPairC16 = enregistrementsC16.Count(enregistrement => enregistrement[0] == 2);
int nbCommutateurC16 = enregistrementsC16.Count(enregistrement => enregistrement[0] == 3);
Console.WriteLine("produits enumeres : " + (totalC16 - nbCommutateurC16).ToString(CultureInfo.InvariantCulture));
Console.WriteLine("enregistrements totaux : " + totalC16.ToString(CultureInfo.InvariantCulture));
Console.WriteLine("par construction : fixe " + nbFixeC16 + ", impair " + nbImpairC16 + ", pair " + nbPairC16
+ ", commutateur " + nbCommutateurC16);
// Forme de chaque ligne : 3 en-têtes, puis par terme nbLettres, ses (slot, lettre), son coefficient.
bool formesC16 = true;
foreach (int[] ligneC16 in enregistrementsC16)
{
int kC16 = 3;
for (int termeC16 = 0; termeC16 < ligneC16[2]; termeC16++)
{
int nbLettresC16 = ligneC16[kC16++];
for (int lettreC16 = 0; lettreC16 < nbLettresC16; lettreC16++)
{
int slotC16 = ligneC16[kC16], indiceC16 = ligneC16[kC16 + 1];
int borneC16 = slotC16 == 1 || slotC16 == 3 ? 7 : 2; // 8 lettres sur un slot qutrit, 3 sur un slot qubit
if (indiceC16 < 0 || indiceC16 > borneC16)
{
formesC16 = false;
}
kC16 += 2;
}
int coefficientC16 = ligneC16[kC16++];
if (coefficientC16 != 1 && coefficientC16 != -1 && coefficientC16 != 2 && coefficientC16 != -2)
{
formesC16 = false;
}
}
if (kC16 != ligneC16.Length)
{
formesC16 = false;
}
}
// Empreinte de la table (témoin de transcription) : roulement en base 31 sur toutes les valeurs, modulo 1 000 000 007.
long empreinteC16 = 0;
foreach (int[] ligneC16 in enregistrementsC16)
{
foreach (int valeurC16 in ligneC16)
{
empreinteC16 = (empreinteC16 * 31 + valeurC16 + 5) % 1000000007;
}
}
// Assertions exactes : sur des entiers, aucune tolérance.
Exige(totalC16 == 172, "172 enregistrements dans la table saisie");
Exige(totalC16 - nbCommutateurC16 == 169 && nbCommutateurC16 == 3, "169 enregistrements de produit et 3 commutateurs");
Exige(nbFixeC16 == 11 && nbImpairC16 == 79 && nbPairC16 == 79, "par construction : fixe 11, impair 79, pair 79");
Exige(formesC16, "chaque ligne est bien formee : en-tetes, lettres dans leur slot, coefficients +-1 ou +-2");
Exige(empreinteC16 == 903342103, "empreinte de la table saisie (temoin de transcription) : 903342103");