Constipation in little ones, especially newborns, is so frustrating and a little scary. Both my boys had problems with it early on (like 10 days average, 2 weeks max). We've tried everything mentioned here (karo syrup, apple/pear juice, prune juice, thermometer, suppositories, Miralax) and I've spent hours and hours, probably days, researching as my 4.5 yo continues to be chronically constipated. The 2 year old seemed to move out of it once he started solids (he was breastfed). Constipation is often a sign of food sensitivity which is especially common when babies guts are still developing and are "leaky," until around six months on average. Both my boys were sensitive to dairy. My second was sensitive to a host of other foods in my breastmilk until he was about seven months old and I suspect if I'd known to try eliminating with my oldest I'd have found that he was sensitive as well. I know that doesn't help much since you're baby is on formula. You could switch to a non-dairy formula but soy is a very poor alternative (I can give you information on why if you're interested) and the hypo-allergenic is very expensive, although very helpful and necessary for babies who are intolerant of dairy and soy. Using the iron-free formula for most feedings is a wonderful idea.
The thermometer trick is probably the safest for an 5 week old. It just stimulates the bowels to go. Warm baths can do the trick for other babies. The fruit juices are probably the next safest, although I have seen recommendations not to use before 3 months. The sugar draws extra fluid into the bowel and softens the stool. Corn (Karo brand) syrup or just plain table sugar dissolved in water can be used at about 1 tsp. per 4 oz for corn syrup and 1tsp per 1 oz for table sugar. Give one ounce of either solution 2xs a day until stool softens. Too much sugar or juice can cause gas and bloating and then you have a cranky baby for other reasons :) If she goes several days and seems really miserable then you might consider Baby-lax suppositories. Use the kind that is squirted instead of the suppositories that need to held in place. Miralax, formerly by perscription, but now an OTC drug, was suggested but I'd highly advise against it's use for a baby or any other child (or adult for that matter). It has not been tested or approved for use in anyone under 18 and has been used off-label without adequate testing. Lots of parents have found their children develop serious issues after using Miralax, from tics to increases in autistic behavior to oxalate dumping. For those with older children who have chronic constipation like my son, there are numerous alternative treatments with varying results for each individual. My son does well on magnesium citrate powder and prune juice. Since your little girl is only 5 weeks old you probably won't ever have to worry about that issue. Good luck, I hope you're able to find some comfort and relief for your daughter.