math
posted by anonymus on .
The following pattern continues indefinitely.
REPEATREPEATREPEAT…
1) What is the 38th letter in the pattern? Explain your answer.
2) What is the 40th letter in the pattern? Explain your answer.
3) What is the 604th letter in the pattern? Explain your answer.

This is an excellent application of the modulo function: mod.
We define a mod b as the remainder when integers a is divided by b, as in:
17 mod 6 = 5
9 mod 4 = 1
etc.
From the given string of characters, we see that the repetition is every 6 characters. So really, it is the same character whether we add or subtract multiples of 6. For example,
the second character is E, but it is the same character as the 8th, the 14th, 20th, 26th, etc.
In fact, if we make use of the modulo function, we conclude that the 38th character is the same as the
(38 mod 6)th = 2nd character (= E)
So the 41th character is simply
(41 mod 6)=5th character (=A).
Proceed to find the 604th, 104820th, etc. character!