How do you decide how many us representatives each state can have?

its based on the states population and some kind of math formula!! ;D P.S good luck trying to find the formula!