Stores logX to the base K
k = int ( math . log ( x , base ) ) NEW_LINE if abs ( base ** k - x ) < abs ( base ** ( k + 1 ) - x ) : NEW_LINE INDENT return base ** k NEW_LINE DEDENT else : NEW_LINE INDENT return base ** ( k + 1 ) NEW_LINE DEDENT