Centered cube number | Centered cube number function ; Formula to calculate nth Centered cube number return it into main function . ; Driver Code
def centered_cube ( n ) : NEW_LINE INDENT return ( 2 * n + 1 ) * ( n * n + n + 1 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 3 NEW_LINE print ( n , " th ▁ Centered ▁ cube ▁ " + " number ▁ : ▁ " , centered_cube ( n ) ) NEW_LINE n = 10 NEW_LINE print ( n , " th ▁ Centered ▁ cube ▁ " + " number ▁ : ▁ " , centered_cube ( n ) ) NEW_LINE DEDENT