-
Notifications
You must be signed in to change notification settings - Fork 0
/
9-chord.nb
192 lines (171 loc) · 7.39 KB
/
9-chord.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
k = 0;
Clear[t1, t2, t3, t4, t5, t6, t7, t8, t9, at, Pairs];
at = ConstantArray[0, 18];
at[[1]] = 1;
EandTstat = Table[{e, 0}, {e, 0, 36}];
For[l1 = 2, l1 < 19, l1++,
at[[l1]] = 1;
t1[1, l1] = {1, l1};
If[l1 == 2, l2 = 3, l2 = 2];
at[[l2]] = 1;
For [l3 = l2 + 1, l3 < 19, l3++,
If [l3 != l1,
at[[l3]] = 1;
t2[l2, l3] = {l2, l3};
it = 0;
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1;
For [kt = 1, kt < 19, kt++,
If [it == 0, l4 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l4]] = 1;
For [l5 = l4 + 1, l5 < 19, l5++,
If [l5 != l1 && l5 != l2 && l5 != l3,
t3[l4, l5] = {l4, l5};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1; at[[l4]] = 1;
at[[l5]] = 1;
it = 0;
(**Print[at[[1]],at[[2]],at[[3]],at[[4]],at[[5]],at[[6]],at[[
7]]];**)
For [kt = 1, kt < 19, kt++,
If [it == 0, l6 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l6]] = 1;
For [l7 = l6 + 1, l7 < 19, l7++,
If [l7 != l1 && l7 != l2 && l7 != l3 && l7 != l4 &&
l7 != l5,
t4[l6, l7] = {l6, l7};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1; at[[l4]] = 1;
at[[l5]] = 1; at[[l6]] = 1; at[[l7]] = 1;
it = 0;
For [kt = 1, kt < 19, kt++,
If [it == 0, l8 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l8]] = 1;
For [l9 = l8 + 1, l9 < 19, l9++,
If [l9 != l1 && l9 != l2 && l9 != l3 && l9 != l4 &&
l9 != l5 && l9 != l6 && l9 != l7,
t5[l8, l9] = {l8, l9};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1; at[[l4]] = 1;
at[[l5]] = 1; at[[l6]] = 1; at[[l7]] = 1; at[[l8]] = 1;
at[[l9]] = 1;
it = 0;
For [kt = 1, kt < 19, kt++,
If [it == 0, l10 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l10]] = 1;
For [l11 = l10 + 1, l11 < 19, l11++,
If [l11 != l1 && l11 != l2 && l11 != l3 && l11 != l4 &&
l11 != l5 && l11 != l6 && l11 != l7 && l11 != l8 &&
l11 != l9,
t6[l10, l11] = {l10, l11};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1;
at[[l4]] = 1; at[[l5]] = 1; at[[l6]] = 1;
at[[l7]] = 1; at[[l8]] = 1; at[[l9]] = 1;
at[[l10]] = 1; at[[l11]] = 1;
it = 0;
For [kt = 1, kt < 19, kt++,
If [it == 0, l12 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l12]] = 1;
For [l13 = l12 + 1, l13 < 19, l13++,
If [l13 != l1 && l13 != l2 && l13 != l3 &&
l13 != l4 && l13 != l5 && l13 != l6 && l13 != l7 &&
l13 != l8 && l13 != l9 && l13 != l10 &&
l13 != l11,
t7[l12, l13] = {l12, l13};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1;
at[[l4]] = 1; at[[l5]] = 1; at[[l6]] = 1;
at[[l7]] = 1; at[[l8]] = 1; at[[l9]] = 1;
at[[l10]] = 1; at[[l11]] = 1; at[[l12]] = 1;
at[[l13]] = 1;
it = 0;
For [kt = 1, kt < 19, kt++,
If [it == 0, l14 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l14]] = 1;
For [l15 = l14 + 1, l15 < 19, l15++,
If [l15 != l1 && l15 != l2 && l15 != l3 &&
l15 != l4 && l15 != l5 && l15 != l6 && l15 != l7 &&
l15 != l8 && l15 != l9 && l15 != l10 &&
l15 != l11 && l15 != l12 && l15 != l13,
t8[l14, l15] = {l14, l15};
at[[l1]] = 1; at[[l2]] = 1; at[[l3]] = 1;
at[[l4]] = 1; at[[l5]] = 1; at[[l6]] = 1;
at[[l7]] = 1; at[[l8]] = 1; at[[l9]] = 1;
at[[l10]] = 1; at[[l11]] = 1; at[[l12]] = 1;
at[[l13]] = 1;
at[[l14]] = 1; at[[l15]] = 1;
it = 0;
For [kt = 1, kt < 19, kt++,
If [it == 0, l16 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l16]] = 1;
For [l17 = l16 + 1, l17 < 19, l17++,
If [l17 != l1 && l17 != l2 && l17 != l3 &&
l17 != l4 && l17 != l5 && l17 != l6 && l17 != l7 &&
l17 != l8 && l17 != l9 && l17 != l10 &&
l17 != l11 && l17 != l12 && l17 != l13 &&
l17 != l14 && l17 != l15,
t9[l16, l17] = {l16, l17};
k = k + 1;
(**Print[" k = ",k," ", l1,l2,l3,l4,l5,l6,l7];**)
Pairs = {t1[1, l1], t2[l2, l3], t3[l4, l5],
t4[l6, l7], t5[l8, l9], t6[l10, l11],
t7[l12, l13], t8[l14, l15], t9[l16, l17]};
at = ConstantArray[0, 18]; at[[1]] = 1;
adj = ConstantArray[0, {9, 9}];
For[i = 1, i < 10, i++,
For[j = i + 1, j < 10, j++,
crossingtemp = 0;
temp1 = Pairs[[i]][[2]];
temp2 = Pairs[[j]][[1]];
temp3 = Pairs[[j]][[2]];
If[temp1 > temp2, crossingtemp = crossingtemp + 1];
If[temp1 > temp3, crossingtemp = crossingtemp + 1];
crossingtemp = Mod[crossingtemp, 2];
adj[[i, j]] = crossingtemp;
];];
adj = adj + Transpose[adj];
e = 1/2 Tr[adj.adj];
t = 1/6 Tr[adj.adj.adj];
EandTstat[[e + 1, 2]] =
EandTstat[[e + 1, 2]] + t;
];];];];];];];];];];];];];];];];] // AbsoluteTiming
{7802.96, Null}
k - 945*11*13*15*17
0
EandTstat
{{0, 0}, {1, 0}, {2, 0}, {3, 18564}, {4, 111384}, {5, 389844}, {6,
1005312}, {7, 2099160}, {8, 3752784}, {9, 5937624}, {10,
8495784}, {11, 11166552}, {12, 13643520}, {13, 15631704}, {14,
16904664}, {15, 17345304}, {16, 16957296}, {17, 15847128}, {18,
14189832}, {19, 12194712}, {20, 10071072}, {21, 7999299}, {22,
6112656}, {23, 4491927}, {24, 3170772}, {25, 2146437}, {26,
1390464}, {27, 859401}, {28, 504504}, {29, 279279}, {30,
144144}, {31, 68211}, {32, 28908}, {33, 10593}, {34, 3168}, {35,
693}, {36, 84}}
{{0, 0}, {1, 0}, {2, 0}, {3, 4368}, {4, 21840}, {5, 65520}, {6,
145600}, {7, 262080}, {8, 404768}, {9, 553280}, {10, 682640}, {11,
771680}, {12, 808640}, {13, 791168}, {14, 726320}, {15,
628160}, {16, 513440}, {19, 397280}, {18, 290768}, {19,
200960}, {20, 130880}, {21, 80080}, {22, 45760}, {23, 24112}, {24,
11440}, {25, 4720}, {26, 1600}, {27, 400}, {28, 56}}
evencount = 0;
oddcount = 0;
Do[evencount = evencount + EandTstat[[i, 2]], {i, 1, 37, 2}]
Do[oddcount = oddcount + EandTstat[[i, 2]], {i, 2, 37, 2}]
evencount
oddcount
96486348
96486432
evencount + oddcount
evencount - oddcount
192972780
-84