-
Notifications
You must be signed in to change notification settings - Fork 0
/
7-chord.nb
151 lines (132 loc) · 4.82 KB
/
7-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
k = 0;
Clear[t1, t2, t3, t4, t5, t6, t7, at, Pairs];
at = ConstantArray[0, 14];
at[[1]] = 1;
For[l1 = 2, l1 < 15, l1++,
at[[l1]] = 1;
t1[1, l1] = {1, l1};
If[l1 == 2, l2 = 3, l2 = 2];
at[[l2]] = 1;
For [l3 = l2 + 1, l3 < 15, 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 < 15, kt++,
If [it == 0, l4 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l4]] = 1;
For [l5 = l4 + 1, l5 < 15, 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 < 15, kt++,
If [it == 0, l6 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l6]] = 1;
For [l7 = l6 + 1, l7 < 15, 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 < 15, kt++,
If [it == 0, l8 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l8]] = 1;
For [l9 = l8 + 1, l9 < 15, 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 < 15, kt++,
If [it == 0, l10 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l10]] = 1;
For [l11 = l10 + 1, l11 < 15, 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 < 15, kt++,
If [it == 0, l12 = kt];
If[at[[kt]] == 0, it = 1];
];
at[[l12]] = 1;
For [l13 = l12 + 1, l13 < 15, 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};
k = k + 1;
(**Print[" k = ",k," ", l1,l2,l3,l4,l5,l6,l7];**)
Pairs[k] = {t1[1, l1], t2[l2, l3], t3[l4, l5],
t4[l6, l7], t5[l8, l9], t6[l10, l11],
t7[l12, l13]};
at = ConstantArray[0, 14]; at[[1]] = 1;
];];];];];];];];];];];];]
k - 945*11*13
0
adj = ConstantArray[0, {945*11*13, 7, 7}];(*adjacency matrix*)
edgeAndtriangle =
ConstantArray[
0, {945*11*13, 1, 2}];(*list of {# of edges, # of triangles}*)
For[
c = 1, c < 945*11*13 + 1, c++,
For[i = 1, i < 8, i++,
For[j = i + 1, j < 8, j++,
crossingtemp = 0;
temp1 = Pairs[c][[i]][[2]];
temp2 = Pairs[c][[j]][[1]];
temp3 = Pairs[c][[j]][[2]];
If[temp1 > temp2, crossingtemp = crossingtemp + 1];
If[temp1 > temp3, crossingtemp = crossingtemp + 1];
crossingtemp = Mod[crossingtemp, 2];
adj[[c, i, j]] = crossingtemp;
];];
adj[[c]] = adj[[c]] + Transpose[adj[[c]]];
edge = 1/2 Tr[adj[[c]].adj[[c]]];
triangle = 1/6 Tr[adj[[c]].adj[[c]].adj[[c]]];
edgeAndtriangle[[c]] = {edge, triangle};
]
EandTstat =
Table[{e, 0}, {e, 0,
21}];(*Given number of edges, this summarizes the total number of \
triangles*)
For[c = 1, c < 945*11*13 + 1, c++,
e = edgeAndtriangle[[c, 1]];
t = edgeAndtriangle[[c, 2]];
EandTstat[[e + 1, 2]] = EandTstat[[e + 1, 2]] + t;]
EandTstat
{{0, 0}, {1, 0}, {2, 0}, {3, 1001}, {4, 4004}, {5, 10010}, {6,
18564}, {7, 27755}, {8, 35672}, {9, 40404}, {10, 40950}, {11,
37674}, {12, 31850}, {13, 24752}, {14, 17654}, {15, 11550}, {16,
6930}, {17, 3780}, {18, 1806}, {19, 714}, {20, 210}, {21, 35}}
evencount = 0;
oddcount = 0;
Do[evencount = evencount + EandTstat[[i, 2]], {i, 1, 22, 2}]
Do[oddcount = oddcount + EandTstat[[i, 2]], {i, 2, 22, 2}]
evencount
oddcount
157640
157675
evencount + oddcount
315315