2

If I have a set of letters $\{a,b,c\}$ which will repeat five times, i.e. $$a,a,a,a,a,b,b,b,b,b,c,c,c,c,c,a,a,a,a,a,\cdots,$$ how can I determine what letter will be in a given position, i.e. $168$?

Ѕᴀᴀᴅ
  • 34,263
  • So it's just five $a$'s followed by five $b$'s followed by five $c$'s and this just repeats indefinitely? – Dave Apr 05 '18 at 02:47

1 Answers1

2

You know one cycle of the pattern is of length $15$, since you would have {aaaaabbbbbccccc}, then repeat. Given a position, you can perform modulo $15$ to find the local index of the respective pattern you are on. For example, $168\equiv 3 \mod 15$, so you would have the third letter in the pattern, which is $'a'$.

Jesse Meng
  • 1,310
  • Knowing that each element in my set repeats 5 times, how do I determine which element in my set is the 3rd of the pattern? (I am a computer I can round or truncate decimal) – DecentGradient Apr 05 '18 at 15:45
  • 1
    @DLinNYC Suppose you have a number x modulo 15, you want to find out the letter in the pattern that matches this number, you can simply do a check: if $1\leq x \leq5$, then you get $a$,if $6\leq x \leq10$, then you get $b$, and otherwise you get c. – Jesse Meng Apr 05 '18 at 23:50