A sequence {S(n)} consists entirely of the digits 0,1, 2, or 6 and all permutations and combinations thereof. For example, any of 0, 2, 6, 26, 162, 12060, 6611120 etc are valid terms of the sequence. None of the other six digits occur in the said sequence.
All the terms of {S(n)} are now arranged in strictly ascending order of magnitude.
What is the 2016th term of the above sequence?
number of how many how many
digits this size this size or smaller
1 4 4
2 12 16
3 48 64
4 192 256
5 768 1024
6 3072 4096
The 2016th term will have 6 digits and will be the (2016 - 1024)th entry with 6 digits; that's the 992nd 6-digit entry.
Of the 6-digit entries, 4^5 = 1024 begin with a 1, so the sought term does start with a 1, as this number is larger than 992.
Of the 6-digit entries starting with a 1, 4^4 = 256 have a zero as the second digit; the same number have 1 as the second digit; likewise for 2 as the second digit. Those total 768, so the sought term begins 16 and is the (992 - 768) such number: the 224th 6-digit entry that begins 16....
Of such numbers 4^3 = 64 have any particular number in the third position, so digits 0, 1 and 2 account for 192 terms. The sought term is the (224 - 192)th = 32nd 6-digit entry beginning 166....
The first 16 such numbers have 0 in the fourth position and the next 16 have 1 in the fourth position and or goal number is the last one that has that 1: 166166.
|
Posted by Charlie
on 2016-05-18 19:43:55 |