#P3922. Counting Numbers with Leading Digit 4 in a Power-of-2 Sequence
Counting Numbers with Leading Digit 4 in a Power-of-2 Sequence
Counting Numbers with Leading Digit 4 in a Power-of-2 Sequence
In this problem, you are given a sequence defined by the formula (x_n = 2^{n-1}). Your task is to compute how many terms among the first (k+1) terms (i.e. from (n=1) to (n=k+1)) have a first digit of 4. For example, the number 4096 (which is (2^{12})) begins with the digit 4.
Note: The input is provided in an encrypted form. Please refer to the input format for further details on how to handle the encrypted input.
inputFormat
The input consists of a single line containing an encrypted integer (k). After decryption, (k) (a non-negative integer) represents the index such that you need to consider the first (k+1) terms of the sequence.
outputFormat
Output a single integer representing the count of terms among the first (k+1) terms whose first digit is 4.
sample
3
1