EKG sequence convergence: Difference between revisions

Content added Content deleted
m (→‎{{header|zkl}}: added ekg(10))
(→‎{{header|Go}}: Extended to generate EKG(9) and EKG(10) and the first 30 terms for all 5 cases.)
Line 160: Line 160:
func main() {
func main() {
const limit = 100
const limit = 100
starts := [3]int{2, 5, 7}
starts := [5]int{2, 5, 7, 9, 10}
var ekg [3][limit]int
var ekg [5][limit]int


for s, start := range starts {
for s, start := range starts {
Line 176: Line 176:
}
}
}
}
fmt.Printf("EKG(%d): %v\n", start, ekg[s][:10])
fmt.Printf("EKG(%2d): %v\n", start, ekg[s][:30])
}
}


// now compare EKG5 and EKG7 for convergence
// now compare EKG5 and EKG7 for convergence
Line 191: Line 191:
{{out}}
{{out}}
<pre>
<pre>
EKG(2): [1 2 4 6 3 9 12 8 10 5]
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]
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]
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
EKG(5) and EKG(7) converge at term 21