#P2759. Smallest Integer x such that \(x^x\) has at Least n Digits
Smallest Integer x such that \(x^x\) has at Least n Digits
Smallest Integer x such that (x^x) has at Least n Digits
Given a positive integer n, find the smallest positive integer x such that the number x raised to the power of x (\(x^x\)) has at least n digits.
You may use the formula for the number of digits of a number y given by:
\[ \text{digits}(y) = \lfloor \log_{10}(y) \rfloor + 1 \]
For the expression \(x^x\), the number of digits is:
\[ \text{digits}(x^x) = \lfloor x \cdot \log_{10}(x) \rfloor + 1 \]
Your task is to determine the smallest integer x that satisfies:
\[ \lfloor x \cdot \log_{10}(x) \rfloor + 1 \ge n \]
Note: When x = 1, since \(1^1 = 1\), it has 1 digit.
inputFormat
The input consists of a single integer n (1 ≤ n ≤ 1000) representing the minimum number of digits required for \(x^x\) to have.
outputFormat
Output the smallest positive integer x such that \(x^x\) contains at least n digits.
sample
1
1