smallest perimiter rectangle with given integer area and integer sides
        Posted  
        
            by 
                remuladgryta
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by remuladgryta
        
        
        
        Published on 2012-06-02T09:35:57Z
        Indexed on 
            2012/06/02
            10:40 UTC
        
        
        Read the original article
        Hit count: 296
        
Given an integer area A, how can one find integer sides w and h of a rectangle such that w*h = A and w+h is as small as possible? I'd rather the algorithm be simple than efficient (although within reasonable efficiency).
What would be the best way to accomplish this?
Finding out the prime factors of A, then combining them in some way that tries to balance w and h? Finding the two squares with integer sides with areas closest to A and then somehow interpolating between them? Any other method i'm not thinking of?
© Stack Overflow or respective owner