Bereshit Rabbah
Bereshit Rabbah 32:5
The Midrash enumerates the recurring appearance of forty in sacred history — forty days of the Flood, forty years in the desert, Moses' forty days on Sinai — and begins to build the rabbinic framework that forty is the measure of transformation and divine gestation.
אַרְבָּעִים יוֹם וְאַרְבָּעִים לָיְלָה. אָמַר רַבִּי יוֹחָנָן בֶּן זַכַּאי הֵם קִלְקְלוּ אֶת הַצּוּרָה שֶׁנִּתְּנָה לְאַרְבָּעִים יוֹם, לְפִיכָךְ אַרְבָּעִים יוֹם וְאַרְבָּעִים לָיְלָה. (בראשית ז, ד): וּמָחִיתִי אֶת כָּל הַיְקוּם, רַבִּי בֶּרֶכְיָה אָמַר קִיּוּמֵיהּ, רַבִּי אָבוּן אָמַר יְקוּמִינֵיהּ.
“For in seven more days, I will make it rain upon the earth forty days and forty nights, and I will obliterate all existence that I made from on the face of the earth” (Genesis 7:4). “For in seven more days, [I will make it rain upon the earth forty days and forty nights]” – Rabbi Shimon ben Yoḥai said: They violated the Torah that was given in forty days; therefore [the Flood lasted] “forty days and forty nights.” Rabbi Yoḥanan ben Zakai said: They corrupted the human form that comes into being at forty days, therefore [the Flood lasted] “forty days and forty nights.” “I will obliterate all existence [hayekum]” – Rabbi Berekhya said: The living beings [kiyum].