EKG sequence convergence: Difference between revisions

→‎{{header|C}}: Extended to generate EKG(9) and EKG(10) and the first 30 terms for all 5 cases.
(→‎{{header|Kotlin}}: Extended to generate EKG(9) and EKG(10) and the first 30 terms for all 5 cases.)
(→‎{{header|C}}: Extended to generate EKG(9) and EKG(10) and the first 30 terms for all 5 cases.)
Line 75:
int main() {
int s, n, i;
int starts[35] = {2, 5, 7, 9, 10};
int ekg[35][LIMIT];
for (s = 0; s < 35; ++s) {
ekg[s][0] = 1;
ekg[s][1] = starts[s];
Line 90:
}
}
printf("EKG(%d2d): [", starts[s]);
for (i = 0; i < 1030; ++i) printf("%d ", ekg[s][i]);
printf("\b]\n");
}
 
// now compare EKG5 and EKG7 for convergence
for (i = 2; i < LIMIT; ++i) {
Line 108:
{{out}}
<pre>
EKG( 2): [1 2 4 6 3 9 12 8 10 5 15 18 14 7 21 24 16 20 22 11 33 27 30 25 35 28 26 13 39 36]
EKG( 5): [1 5 10 2 4 6 3 9 12 8 14 7 21 15 18 16 20 22 11 33 24 26 13 39 27 30 25 35 28 32]
EKG( 7): [1 7 14 2 4 6 3 9 12 8 10 5 15 18 16 20 22 11 33 21 24 26 13 39 27 30 25 35 28 32]
EKG( 9): [1 9 3 6 2 4 8 10 5 15 12 14 7 21 18 16 20 22 11 33 24 26 13 39 27 30 25 35 28 32]
EKG(10): [1 10 2 4 6 3 9 12 8 14 7 21 15 5 20 16 18 22 11 33 24 26 13 39 27 30 25 35 28 32]
 
EKG(5) and EKG(7) converge at term 21
9,490

edits