-
-
Save Plutor/7790513 to your computer and use it in GitHub Desktop.
If your descendants alternated marrying someone completely of $ethnicity and someone not, they would approach 1/3 and 2/3 of that ethnicity.
Re: <http://www.reddit.com/r/learnmath/comments/1s0vyx/what_is_the_fewest_number_of_generations_that_it/>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fraction_ethnic = 0.0 | |
for generation in range(20): | |
spouse_ethnic = generation % 2 | |
child_ethnic = (fraction_ethnic + spouse_ethnic) / 2.0 | |
print ( | |
'Generation %d: Parents %.3f%% and %d%% ethnic had a child %.3f%% ethnic' % | |
(generation, fraction_ethnic*100, spouse_ethnic*100, child_ethnic*100) | |
) | |
fraction_ethnic = child_ethnic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generation 0: Parents 0.000% and 0% ethnic had a child 0.000% ethnic | |
Generation 1: Parents 0.000% and 100% ethnic had a child 50.000% ethnic | |
Generation 2: Parents 50.000% and 0% ethnic had a child 25.000% ethnic | |
Generation 3: Parents 25.000% and 100% ethnic had a child 62.500% ethnic | |
Generation 4: Parents 62.500% and 0% ethnic had a child 31.250% ethnic | |
Generation 5: Parents 31.250% and 100% ethnic had a child 65.625% ethnic | |
Generation 6: Parents 65.625% and 0% ethnic had a child 32.812% ethnic | |
Generation 7: Parents 32.812% and 100% ethnic had a child 66.406% ethnic | |
Generation 8: Parents 66.406% and 0% ethnic had a child 33.203% ethnic | |
Generation 9: Parents 33.203% and 100% ethnic had a child 66.602% ethnic | |
Generation 10: Parents 66.602% and 0% ethnic had a child 33.301% ethnic | |
Generation 11: Parents 33.301% and 100% ethnic had a child 66.650% ethnic | |
Generation 12: Parents 66.650% and 0% ethnic had a child 33.325% ethnic | |
Generation 13: Parents 33.325% and 100% ethnic had a child 66.663% ethnic | |
Generation 14: Parents 66.663% and 0% ethnic had a child 33.331% ethnic | |
Generation 15: Parents 33.331% and 100% ethnic had a child 66.666% ethnic | |
Generation 16: Parents 66.666% and 0% ethnic had a child 33.333% ethnic | |
Generation 17: Parents 33.333% and 100% ethnic had a child 66.666% ethnic | |
Generation 18: Parents 66.666% and 0% ethnic had a child 33.333% ethnic | |
Generation 19: Parents 33.333% and 100% ethnic had a child 66.667% ethnic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment