The string abbcccddddeeeee.... continuously repeats - with a repeating once, b repeating twice and so on, such that after the final z, the letters abbcccddddeeeee.... begin again.
What will be the 2010th letter in the above pattern?
As a bonus, what will be the 2010th letter in the above pattern, if instead - after the final z, the next a repeats 27 times, then b repeats 28 times and so forth?
The sum of the first 26 whole numbers is 27*26/2 = 351. Dividing 2010 by 351 leaves a remainder of 255, so we seek the 255th letter of the 351-letter sequence. We need the first n for which (n+1)*n/2 equals or exceeds 255.
Solving n^2 + n - 510 = 0 gives a positive value of
-1 + sqrt(1 + 2040)
------------------- ~= 22.0887
2
so that n = 22 fails to meet the mark, but n = 23 does. The letter is w. As a check 24+25+26 = 75, while 351 - 255 = 96 and the difference between 75 and 96 is 21, which is more than covered by the 23 w's.
Bonus:
This time we need (n+1)*n/2 >= 2010
-1 + sqrt(1 + 16080)
-------------------- ~= 62.905
2
so we seek the 63rd letter of the repeated alphabet, or the (63-52)th, i.e., the 11th, which is k.
|
Posted by Charlie
on 2010-10-18 14:22:19 |