Search
⌘K

Leetcode 483. Smallest Good Base

Given n (<= 1e18), find the smallest integer base k >= 2 such that n's base-k representation is all 1s — i.e., n = 1 + k + k^2 + ... + k^m for some m >= 1. This reduces to finding integer pairs (k, m) satisfying that geometric series equation and choosing the minimal k.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.