We are so sorry to hear about your recent miscarriages.
The first pregnancy you experienced was under 40 days. We count the 40 days from the night you returned from the mikveh, which was about 4 weeks in your situation. The medical convention is to count weeks of pregnancy from the most recent menstrual period. But halachically, pregnancy is dated from conception, which is usually presumed to be mikveh night.
In the case of your second pregnancy, as there was no embryo it would not preclude you from having a
pidyon haben in the future.
You may find that our page on
Pregnancy Loss has other helpful resources for you at this time.
May you have a
refuat hanefesh and
refuat haguf.