La Genèse 18:32 Midrash : Devarim Rabbah, Midrash Tanchuma, Pirkei DeRabbi Eliezer & Bereshit Rabbah

וַ֠יֹּאמֶר אַל־נָ֞א יִ֤חַר לַֽאדֹנָי֙ וַאֲדַבְּרָ֣ה אַךְ־הַפַּ֔עַם אוּלַ֛י יִמָּצְא֥וּן שָׁ֖ם עֲשָׂרָ֑ה וַיֹּ֙אמֶר֙ לֹ֣א אַשְׁחִ֔ית בַּעֲב֖וּר הָעֲשָׂרָֽה׃

"De grâce, que mon Souverain ne s’irrite pas, je ne parlerai plus que cette fois. Peut-être s’en trouvera-t-il dix?" Il répondit: "Je renoncerai à détruire, en faveur de ces dix."

Devarim Rabbah

Another matter, “carve for you” – Rabbi Yitzḥak said: It is written: “It will be when he shall sin and is guilty, he shall restore the robbed item that he robbed, or the proceeds of the exploitation that he exploited, or the deposit that was deposited with him, or the lost item that he found” (Leviticus 5:23). The Holy One blessed be He said to him: ‘Were the Tablets not deposited with you? You shattered them, you replace them.’
Rabbi Yitzḥak said: With the second Tablets, Moses reconciled the Holy One blessed be He with Israel. What did he do? He ascended to the Holy One blessed be He, who was angry. He said to Him: ‘Your children are sinning, and You are imposing a penalty upon me?’ [Moses] presented himself as though he was angry at Israel.27He allowed himself to actually get angry, rather than conquering his anger in order to pray on their behalf (see Etz Yosef; Maharzu). From where is this derived? As it is stated: “Moses returned to the Lord and he said: Please; this people has sinned a great sin, and they made themselves a god of gold. Now, if You would, forgive their sin; but if not, erase me please from Your book that You have written” (Exodus 32:31–32).28Rather than pleading with God to forgive the Israelites, Moses asked God that, if He would not forgive them, He would erase Moses from His book as well. When the Holy One blessed be He saw that it was so, He said to him: ‘There are two beings who are angry; you and I are angry at them.’29If we are both angry at the Israelites, they are doomed. Immediately: “The Lord would speak to Moses face to face, as a man speaks to his friend, and he would return to the camp. But his servant, Joshua, son of Nun, a lad, would not move from within the tent” (Exodus 33:11). The Holy One blessed be He said to him: ‘There shall not be two beings angry, instead, when you see Me pouring boiling water, you pour cold; and when you see Me pouring cold water, you pour boiling.’ Moses said to him: ‘Master of the universe, how shall it be?’ He said to him: ‘You implore for mercy.’ What did he do? Immediately, “Moses implored [vayḥal] the Lord his God and he said: Lord, why shall Your wrath be enflamed against Your people that You took out of the land of Egypt with great power and with a mighty hand? Why should the Egyptians speak, saying: He took them out for evil, to kill them in the mountains and to destroy them from upon the face of the earth? Relent from Your enflamed wrath and reconsider regarding the evil for Your people” (Exodus 32:11–12). He said to Him: ‘Your children are bitter, sweeten [ḥaleh] them.’30They sinned, forgive them.
Another matter, he said before Him: ‘Master of the universe, I know that You love Your children, and You seek only someone to advocate on their behalf.’ Rabbi Simon said: To what is the matter comparable? To a king and his son who were located in an inner chamber, and his son’s tutor was in the hall. The king was shouting: ‘Let me be so I will kill my son!’ He was seeking only that someone advocate on his behalf. So, the Holy One blessed be He said to Moses: “Now, let Me be, and My wrath will be enflamed against them and I will destroy them and I will make you into a great nation” (Exodus 32:10). Moses said: Am I, as it were, grasping the hand of the Holy One blessed be He?31Am I holding Him back, such that He says “Let me be”? He seeks only someone to advocate on their behalf. Immediately, “Moses implored.”
Another matter, “now, let Me be” – Moses said: ‘Master of the universe, do You seek to eradicate them? Uproot the upper worlds and the lower worlds, and then uproot them.’ From where is this derived? As it is stated: “Lift your eyes to the heavens and look to the earth below, as the heavens will be eroded like smoke and the earth will be tattered like a garment, and its inhabitants, likewise, will die, but My salvation will be forever and My righteousness will not be daunted” (Isaiah 51:6). First, the heavens will be eroded like smoke…and then: “Its inhabitants, likewise, will die.” Moses said to Him: ‘Even if You uproot the heavens and the earth, it is impossible for You to uproot Israel, as You took an oath to their patriarchs, and You did not take an oath to them by the heavens or by the earth, but by Your great Name.’ From where is this derived? As it is stated: “To whom You took an oath by Yourself” (Exodus 32:13). [Moses said:] ‘Could You, perhaps void Your great Name?’
Moses said before Him: ‘Consider them like Sodom. What did You say to Abraham? “The Lord said: If I find in Sodom fifty righteous people within the city, I will tolerate the entire place for their sake” (Genesis 18:26), and You were willing to concede to him until ten.’ From where is this derived? As it is stated: “He said: Please, let my Lord not be incensed, and I will speak only this time. Perhaps ten shall be found there. He said: I will not destroy for the ten” (Genesis 18:32). [Moses said before Him:] ‘I will produce for You eighty righteous men.’ He said to him: ‘Produce them.’ He said before Him: ‘Master of the universe, there are seventy elders,’ as it is written: “The Lord said to Moses: Gather to Me seventy men of the elders of Israel, whom you know to be the elders of the people, and its officers, and you shall take them to the Tent of Meeting, and they will stand there with you. I will descend and speak with you there and I will draw from the spirit that is upon you, and I will place it upon them, and they will bear with you the burden of the people, and you will not bear alone” (Numbers 11:16–17). ‘[And] Aaron, Nadav, Avihu, Elazar, Itamar, Pinḥas, and Caleb – that is seventy-seven.’ The Holy One blessed be He said to him: ‘But Moses, where are three more righteous men?’ [Moses] did not find them. He said before Him: ‘Master of the universe, if those who are alive cannot stand in the breach on their behalf, let the dead stand.’ He said before Him: ‘Do it by the merit of the three patriarchs, and that is eighty – “Remember Abraham, Isaac and Israel, Your servants” (Exodus 32:13).’ Once Moses mentioned the merit of the patriarchs, He immediately said to him: “I have pardoned in accordance with your word” (Numbers 14:20).
When Solomon arose and saw that Moses mentioned seventy-seven living righteous men and it would have been of no avail had he not mentioned the merit of the three patriarchs, he began saying: “I praise the dead who are already dead more than the living who are still alive. Better than both of them is one who has not yet been, who has not seen the evil action that is performed under the sun” (Ecclesiastes 4:2–3).
Another matter, “Remember Abraham, Isaac and Israel, Your servants, to whom You swore by Yourself and said to them: I will multiply your offspring like the stars of the heavens, and this entire land that I said I will give to your descendants, they shall inherit it forever. The Lord reconsidered the evil that He had spoken of doing to His people” (Exodus 32:13–14). Rabbi Levi said: Moses said to Him: ‘Master of the universe, will the dead live?’ He said to him: ‘Are you, too, mistaken? Did I not say to you: “I will kill and I will resurrect”?’ (Deuteronomy 32:39). Moses said to Him: ‘If the dead will live, consider it as though the patriarchs are standing and beseeching on behalf of their descendants; what would You answer them?’ When Moses said this matter to Him, immediately, the Lord reconsidered the evil.

Midrash Tanchuma

As soon as Jacob heard that there was corn in Egypt, he said to his sons: Get you down thither, and buy for us from them, etc. And Joseph’s ten brethren went down (ibid. 42:2–3). Why did all ten go? Because in that number resides the power to set aside retribution.4Because ten comprise a minyan and so they could beseech God as a congregation. For example, when the Holy One, blessed be He, was about to destroy Sodom, our patriarch Abraham pleaded for heavenly mercy in their behalf. He spoke first of fifty men, but finally reduced the number to ten, as it is said: Peradventure ten shall be found there (ibid. 18:31). Ten men also comprise a congregation, as is said: How long shall I bear with this evil congregation (Num. 14:27), and God standeth in the congregation of God (Ps. 82:1). Hence Scripture states: Joseph’s ten brethren went down (Gen. 42:3). Just as in the case of Sodom, Scripture speaks here of ten. And the sons of Israel came to buy among those that came (Gen. 42:5), in order that no one would recognize them. The Holy One, blessed be He, declared: Because you have said: We shall see what will become of his dreams (ibid. 37:20), his dream was fulfilled. Joseph saw his brothers and recognized them, but they did not recognize him, for they had felt no compassion for him, while Joseph recognized them because he pitied them.

Pirkei DeRabbi Eliezer

Hence they said: If there be fifty righteous in the world, the world exists through their righteousness. (Abraham) arose and began to beseech (God), and made supplication before Him until he brought (the number down to) ten. Hence (the sages said): (When there are) ten people in a place, the place is delivered by their righteousness, as it is said, "And he said, I will not destroy it for the sake of the ten" (Gen. 18:32).