# [483. Smallest Good Base](https://leetcode.com/problems/smallest-good-base/) ## 题目 For an integer n, we call k>=2 a **good base** of n, if all digits of n base k are 1. Now given a string representing n, you should return the smallest good base of n in string format. **Example 1:** Input: "13" Output: "3" Explanation: 13 base 3 is 111. **Example 2:** Input: "4681" Output: "8" Explanation: 4681 base 8 is 11111. **Example 3:** Input: "1000000000000000000" Output: "999999999999999999" Explanation: 1000000000000000000 base 999999999999999999 is 11. **Note:** 1. The range of n is [3, 10^18]. 2. The string representing n is always valid and will not have leading zeros. ## 题目大意 对于给定的整数 n, 如果n的k(k>=2)进制数的所有数位全为1,则称 k(k>=2)是 n 的一个好进制。 以字符串的形式给出 n, 以字符串的形式返回 n 的最小好进制。 提示: - n 的取值范围是 [3, 10^18]。 - 输入总是有效且没有前导 0。 ## 解题思路 - 给出一个数 n,要求找一个进制 k,使得数字 n 在 k 进制下每一位都是 1 。求最小的进制 k。 - 这一题等价于求最小的正整数 k,满足存在一个正整数 m 使得