Consider the record of Matthew:
So all the generations from Abraham to David were 14 generations; and from David until the exile to Babylon, 14 generations; and from the exile to Babylon until the Messiah, 14 generations (Matt 1:17).
Does this mean there are exactly 42 generations from Abraham to Jesus? No. Matthew omitted several names in his genealogy in order to maintain a three-times-fourteen-generation structure. “Fathered” indicates ancestry, not actual fatherhood. So “all the generations” must be taken to imply “as summarized here.”
“Matthew was emphasizing Jesus’ birth as a culminating moment in Israel’s history,” according to the HCSB Apologetics Study Bible.