There is
one word mistranslated in our english bibles which explains this apparent contradiction.
In matthew 1:16 it should read joseph the
father of mary.
Both Mary's father and husband were called joseph.
The two men are differentiated in the aramaic version of Matthew.
Both words
gowra for father and
baala for husband were translated from aramaic to greek as "aner".
this also means we have 42 (3X14) generations as well.