In 20s you can date someone in 30s. In late 30s someone even in 50s. Age gap seems less as you age individually and socially. No one gives a shit when a 80year old man marries a 60year old woman. Same gap may bother some people when man is 40 and girl is 20. The fornula from HIMYM reflects that.