Largest Component Size by Common Factor python