Consider the following code to produce the sequence $x_1,\ldots,x_{n+1}$ where $x_i=11\cdots1$ ($i$ digits 1). Is there an easier way to do this?
n := 7 X := Table[Sum[10^i, {i, 0, k - 1}], {k, 1, n + 1}] R := Table[Mod[X[[k]], n], {k, 1, n + 1}] X R Also, the code defines the list R of remainders on division of $x_i$ by $n$. The output of R is {1, 4, 6, 5, 2, 0, 1, 4}.
I'd like to do the following: determine the indexes producing the first two equal elements of R (for example, since R[[1]]=R[[7]] I'd like to do some math with X[[1]] and X[[7]]).