Rabbi Berekhya said in the name of Rabbi Neḥemya: This is analogous to a king who was passing from place to place and a gem fell from upon his head. The king stopped walking and stopped his entourage. He made piles of dirt, brought a sieve, and sifted the first pile, but did not find it; the second, but did not find it; the third, and he found it. They said: ‘The king found his gem.’

So, the Holy One blessed be He said: ‘What purpose was there for Me to trace the lineage of Shem, Arpakhshad, Shelaḥ, Ever, Peleg, Re’u, Serug, Naḥor, Teraḥ? It was only for you [Abraham].’ “You found his heart faithful before You” (Nehemiah 9:8).20“Found,” as when one finds a gem. So, too, the Holy One blessed be He said to David: ‘What purpose was there for Me to trace the lineage of Peretz, Ḥetzron, Ram, Aminadav, Naḥshon, Salmon, Boaz, Oved, Yishai? It was only for you: “I found David, My servant; I anointed him with My sacred oil”’ (Psalms 89:21).