Minimum value of K such that sum of cubes of first K natural number is greater than equal to N | Function to determine the minimum value of K such that the sum of cubes of first K natural number is greater than or equal to N ; Variable to store the sum of cubes ; Loop to find the number K ; If C is just greater then N , then break the loop ; Driver code
def naive_find_x ( N ) : NEW_LINE INDENT c = 0 NEW_LINE for i in range ( 1 , N ) : NEW_LINE INDENT c += i * i * i NEW_LINE if c >= N : NEW_LINE INDENT break NEW_LINE DEDENT DEDENT return i NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 100 NEW_LINE print ( naive_find_x ( N ) ) NEW_LINE DEDENT