Modern scholarship tends to see the genealogies of Jesus as theological constructs rather than factual history. Thus the two New Testament genealogies should be understood in terms of what they were meant to achieve, rather than as a collection of facts.
Matthew and Luke provide detailed genealogies for Jesus, back through the great Zorobabel to the line of King David. The author of Matthew wanted Jesus to be descended from the royal line throughout, whereas the author of Luke wanted Jesus' ancestry to remain commoners back as far as David. Thus, in Matthew, the paternal grandfather of Zorobabel is Jeconiah, whereas in Luke he is a commoner called Neri.
Luke's Gospel has great men occur in multiples of 7 generations starting at Adam (inserting Kainan at the 13th generation to achieve this), with Abraham at generation 21 and David at generation 35, with Jesus at 77 proving he too was destined for greatness.
Matthew's Gospel demonstrated (Matthew 1:17) that there were 14 generations from Abraham to David; from David to Josiah (omitting three kings in the Old Testament list); from Josiah to Jesus, so also proving Jesus was destined for greatness. However, the Old Testament only lists 20 generations from Adam to Abraham, whereas this genealogy would require 28 generations from Adam to Abraham to work as intended. Thus, Matthew's genealogy does not go back to Adam, but only as far as Abraham.