Why does my code stop working after the 6th iteration? I can’t get Subscript[x, 7] or any values after that. I am trying to assign certain values to my xi’s and yi’s given whether we see a 6 in the sequence or not. I get values for x1, x2, x3, x4, x5, and x6 but then the loop terminates.
sequence = {6, 5, 1, 1, 6, 6, 4, 5, 3, 1, 3, 2, 6, 5, 1, 2, 4, 5, 3, 6, 6, 6, 4, 6, 3, 1, 6, 3, 6, 6, 6, 3, 1, 6, 2, 3, 2, 6, 4, 5, 5, 2, 3, 6, 2, 6, 6, 6, 6, 6, 6, 2, 5, 1, 5, 1, 6, 3, 1}; Subscript[x, 1] = N[Log[1/12], 20]; Subscript[y, 1] = N[Log[1/4], 20]; For[i = 2, i <= 59, i++, If[sequence[[i]] == 6, Which[Subscript[x, i - 1] > Subscript[y, i - 1], Subscript[x, i] = Subscript[x, i - 1] + N[Log[(1/6)*0.95], 20]; Subscript[y, i] = Subscript[x, i - 1] + N[Log[0.9*0.5], 20], Subscript[y, i - 1] > Subscript[x, i - 1], Subscript[x, i] = Subscript[y, i - 1] + N[Log[(1/6)*0.95], 20]; Subscript[y, i] = Subscript[y, i - 1] + N[Log[(1/6)*0.95], 20]], Which[Subscript[x, i - 1] > Subscript[y, i - 1], Subscript[x, i] = Subscript[x, i - 1] + N[Log[(1/6)*0.95], 20]; Subscript[y, i] = Subscript[x, i - 1] + N[Log[0.9*0.1], 20], Subscript[y, i - 1] > Subscript[x, i - 1], Subscript[x, i] = Subscript[y, i - 1] + N[Log[(1/6)*0.95], 20]; Subscript[y, i] = Subscript[y, i - 1] + N[Log[(1/10)*0.90], 20]]]];