Lala, the scan does not care about your LMP or cycle length at all. It is based on organ development and growth of the fetus. That is why it is the most accurate estimation of gestational age.
I did use a 30 day cycle for the LMP calculation.
Sperm will normally survive for at least 3 days inside you. If the sperm is healthy it can be 5 days and if everything is perfect it can last up to 7 days.. So given that the 17th is just 4 days away from the 21st and 5 from the 22nd, it is quite possible that it survived. The ovulation dates can also be off by a day or two, so you could have ovulated the 20th for example.
From what you are saying I am getting the idea that you had intercourse with two different men on the 17th and the 22nd? If that is the case, it is impossible to use these calculations to determine paternity. You will have to have a DNA test done.
Take care!