Talmud for Bekhorot 8:1
יֵשׁ בְּכוֹר לַנַּחֲלָה וְאֵינוֹ בְכוֹר לַכֹּהֵן, בְּכוֹר לַכֹּהֵן וְאֵינוֹ בְכוֹר לַנַּחֲלָה, בְּכוֹר לַנַּחֲלָה וְלַכֹּהֵן, יֵשׁ שֶׁאֵינוֹ בְכוֹר לֹא לַנַּחֲלָה וְלֹא לַכֹּהֵן. אֵיזֶהוּ בְּכוֹר לַנַּחֲלָה וְאֵינוֹ בְכוֹר לַכֹּהֵן, הַבָּא אַחַר הַנְּפָלִים שֶׁיָּצָא רֹאשׁוֹ חַי, וּבֶן תִּשְׁעָה שֶׁיָּצָא רֹאשׁוֹ מֵת, וְהַמַּפֶּלֶת כְּמִין בְּהֵמָה חַיָּה וָעוֹף, דִּבְרֵי רַבִּי מֵאִיר. וַחֲכָמִים אוֹמְרִים, עַד שֶׁיְּהֵא בוֹ מִצּוּרַת הָאָדָם. הַמַּפֶּלֶת סַנְדָּל, אוֹ שִׁלְיָא, וּשְׁפִיר מְרֻקָּם, וְהַיּוֹצֵא מְחֻתָּךְ, הַבָּא אַחֲרֵיהֶן, בְּכוֹר לַנַּחֲלָה וְאֵינוֹ בְכוֹר לַכֹּהֵן. מִי שֶׁלֹּא הָיוּ לוֹ בָנִים וְנָשָׂא אִשָּׁה שֶׁכְּבָר יָלְדָה, עוֹדָהּ שִׁפְחָה וְנִשְׁתַּחְרְרָה, עוֹדָהּ נָכְרִית וְנִתְגַּיְּרָה, מִשֶּׁבָּאת לְיִשְׁרָאֵל יָלְדָה, בְּכוֹר לַנַּחֲלָה וְאֵינוֹ בְכוֹר לַכֹּהֵן. רַבִּי יוֹסֵי הַגְּלִילִי אוֹמֵר, בְּכוֹר לַנַּחֲלָה וְלַכֹּהֵן, שֶׁנֶּאֱמַר (שמות יג), פֶּטֶר כָּל רֶחֶם בִּבְנֵי יִשְׂרָאֵל, עַד שֶׁיִּפְטְרוּ רֶחֶם מִיִּשְׂרָאֵל. מִי שֶׁהָיוּ לוֹ בָנִים וְנָשָׂא אִשָּׁה שֶׁלֹא יָלְדָה, נִתְגַּיְּרָה מְעֻבֶּרֶת, נִשְׁתַּחְרְרָה מְעֻבֶּרֶת, יָלְדָה הִיא וְכֹהֶנֶת, הִיא וּלְוִיָּה, הִיא וְאִשָּׁה שֶׁכְּבָר יָלְדָה, וְכֵן מִי שֶׁלֹּא שָׁהֲתָה אַחַר בַּעְלָהּ שְׁלשָׁה חֳדָשִׁים וְנִשֵּׂאת וְיָלְדָה, וְאֵין יָדוּעַ אִם בֶּן תִּשְׁעָה לָרִאשׁוֹן, אוֹ בֶן שִׁבְעָה לָאַחֲרוֹן, בְּכוֹר לַכֹּהֵן וְאֵינוֹ בְכוֹר לַנַּחֲלָה. אֵיזֶהוּ בְּכוֹר לַנַּחֲלָה וְלַכֹּהֵן, הַמַּפֶּלֶת שְׁפִיר מָלֵא דָם, מָלֵא מַיִם, מָלֵא גְנִינִים, הַמַּפֶּלֶת כְּמִין דָּגִים וַחֲגָבִים שְׁקָצִים וּרְמָשִׂים, הַמַּפֶּלֶת יוֹם אַרְבָּעִים, הַבָּא אַחֲרֵיהֶן, בְּכוֹר לַנַּחֲלָה וְלַכֹּהֵן:
There is one who is a firstborn for [inheriting a double] portion but is not a firstborn for [paying his redemption price] to the priest, a firstborn for the priest but not for the portion, [a firstborn] for both the priest and the portion and [a firstborn] for neither the priest nor the portion. Who is the firstborn for the portion but not the priest? One who is born after an abortus whose head emerged [while still] alive [and was then withdrawn], or after a nine-month [stillbirth] whose head emerged [though already dead [and was then withdrawn], or after [woman] miscarries [something that] resembles an animal, beast or bird [these are] the words of Rabbi Meir. The Sages say: until it has the figure of a person. One who miscarries [something that resembles] a sandal or an afterbirth or fetal sac [containing] tissue or a dismembered [fetus], the one that comes after them is a firstborn for the portion but not for the priest. One who never had children and [then] married a woman who already had children - [even if] she was a slave [when she gave birth] and then freed, or she was a non-Jew [when she gave birth] and she converted, and once she became Jewish she gave birth [again], [the baby is] a firstborn for the portion but not for the priest. Rabbi Yossi Haglili says: it is a firstborn for the portion and the priest, as it says (Exodus 13) "Any opening of a womb in Yisrael" - until they open a womb of an Israelite. One who had children and married a woman who had not given birth, or [if a woman] converted pregnant or was freed [from slavery] pregnant, or if she and a woman married to a priest gave birth or she and a woman married to a Levite gave birth or she and a woman who already gave birth, gave birth [and it was not certain whose baby was whose in these cases], and one who did not wait three months after her husband [died] and got married and gave birth and they do not know if it was nine months from the first husband or seven months from the second, the child is a firstborn for the priest but not for the portion. Who is a firstborn for the portion and the priest? One who miscarries a fetal sac full of blood, water, or worm[like tissue], or if she miscarried [something that] resembles fish, locust, insects or reptiles, or one who miscarries on [or before] the fortieth day, the one that comes after them is a firstborn for the portion and the priest.