These four genealogies were written to establish King David’s descent from Judah. Saul, in contrast, was of the disgraced and almost annihilated tribe of Benjamin. Samuel judged Israel even while Saul was king.
The intention was to show the fulfillment of Israel’s (Jacob’s) last words over Judah:
Genesis 49:10 The scepter will not depart from Judah, nor the ruler’s staff from his descendants, until the coming of the one to whom it belongs, the one whom all nations will honor.
We can easily see this as referring to Jesus, but it would have had a more concrete meaning at the time.
The genealogies also place two foreign women, Rahab (a prostitute) and Ruth (of Moab), into David’s and ultimately Jesus’ family line.
These lists are not complete: the gap from Salmon (Rahab’s husband) to Boaz is several hundred years, not one generation. For our western, Greek-influenced minds, the genealogy should look more like this:
Ram (Caleb’s older brother)
Nahshon (a leader of Judah in the wilderness)
Salmon (Rahab’s husband)
… Most of the book of Judges …
(And there could well be other gaps we don’t even know about.)
We have to remember that ‘father of’ (the same as ‘begat’) really means ‘ancestor of’. Abraham, for instance, is often called the ‘father of Israel’, and the Jews in Jesus’ time thought of themselves as Abraham’s children: no one has ever taken that too literally.
It is of some concern that there was no one worth recording between Salmon (the start of Israel’s occupation of Canaan) and Boaz (some several hundred years later).