Which has nothing to do with the problem.Plus the variable names are utterly poor.
I think this has been solved or were the answers that were given incorrect?
Which has nothing to do with the problem.Plus the variable names are utterly poor.
I think this has been solved or were the answers that were given incorrect?
It is in fact the same. Since half the Breeders have boys and half have girls, the number of breeders goes down each breeding cycle, but not the ratio of boys to girls, since they will always be half boys and half girls (in a perfect world). Specifically the ratio will always approach the ratio of male.female births. In real life, more boys are conceived, but more girls are born. Male fetus's have a higher rate of miscarriage. You shoudl also take into account multiple births , both fraternal and identical.
Here is the proof -
Code:#include <stdio.h> int main(){ double Boys = 0.0; double Girls = 0.0; double Breeders = 1.0; while(Breeders > 0.0){ Breeders /= 2.0; Boys += Breeders; Girls += Breeders; printf("Boys - %f Girls - %f \n" , Boys , Girls); } return 0; }
Last edited by abachler; 08-29-2009 at 01:28 PM.
Again, this cannot be proof because you cannot have a half child or half families left that needs to breed a boy.
Eventually, the number cannot be evenly divided by 2, and this is where most algorithms of this kind fails. I have yet to see any good, realistic algorithm to present the answer of a 1:1 ratio.
@cyberfish: Yeah, you were right. I did it right in my first post, but somehow I managed to screw it up in the second.
Your answer was right. It's 50/50. If you don't believe me/us, then go ahead and read my proof and write a program yourself to find out what number it converges to. It will be one. So except for the converging thing the matter has been proved in my post (well, of course you have to fix it for the mistake I made that cyberfish pointed out, but those changes are trivial).
So for everybody: yes, the answer has been given.
Elysia.... Well, really... I don't care. I wrote this program not to be readable, but to as quickly as I could write the program without even thinking. I didn't write it for you guys, except maybe to run it to get the answer. Also, the variables are used little enough for the program still to be understood in one glance of the eye.
No complains about using namespace std? About using parenthesis between a/b which is completely non-required (I have no idea why I put them there, I just typed it out without thinking, as I said). About the infinite loop where I obviously should have an ending when the solution is close enough?
Well, let's say we're lucky I will never sell the program, or release it as open source software.
"nor can there be 12.5 families left that needs to have a boy."
Can you explain that sentence? You obviously didn't read, or completely understand my post, as there is no part about half families or half babies. It assumes an infinite number of families, then I derive an obvious summation, and wrote a simple program to get the number it converges to. That part is no proof, and unless a lot of people are still unconvinced I shall not give it either. I don't even have it yet, either, but I guess I'd be able to figure it out.
The variable names suck. I couldn't make out what the heck they meant or what was what. I give you 0 out of 10 for that code.
And yes, you should probably have broken the loop when the solution was found, otherwise it wouldn't be proof, but more of an informative program.
You didn't start at 100 families as the question said, but the point is the same. Each time there is 50% chance to get a boy."nor can there be 12.5 families left that needs to have a boy."
Can you explain that sentence? You obviously didn't read, or completely understand my post, as there is no part about half families or half babies. It assumes an infinite number of families, then I derive an obvious summation, and wrote a simple program to get the number it converges to. That part is no proof, and unless a lot of people are still unconvinced I shall not give it either. I don't even have it yet, either, but I guess I'd be able to figure it out.
So, first, 50 families get a boy.
Then 25 families get a boy.
Then 12.5 families get a boy (!). There can't be 12.5 families. It's not possible, put simply, and therefore it is wrong.
Come on, are you trolling here or what?
You give me a 0 ou tof 10 for that code. Well woohoo. It's no test. I don't care if you don't understand it. By the looks of it there's a lot in this topic that you don't understand. As the answer has been stated properly several times.
As I even said in the post: it IS no proof. It was *exactly* an informative program. Even if it was written properly it is no proof that this converges to that value, an actual proof would consist of actual math. So yes, newsflash: it WAS an informative program.
And what the heck they meant. Well, if you looked at the formula I proposed you see that it is exactly that formula implemented. If you can't understand those few lines of C code, even if the variable names are poor, then I'm really underwhelmed by your code interpreting skills.
But... 100 families? Maybe you should read before you complain. Nowhere there was an initial number of 100 families.
Yes, I made a mistake in that post. But you've seemed to make a dozen already, if you're not trolling, which I'm not used to from you. It seems to me you just didn't read the posts properly. But I propose you read them properly before you complain about a legit statement being invalid.
Or criticizing code that was never even meant to be good or readable, just to show the number my result converges to. And even if I didn't write it, if you'd actually read my formula I posted above that, I'd think you'd find the program fairly easy to understand.
Ok. Before it becomes a heated discussion just stop this one here only. Here's another one.
I think that every husband will be killed after that. Tell me if it's correct?Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announce that at least one husband has been unfaithful. What happens?
Last edited by BEN10; 08-29-2009 at 09:59 PM.
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
The first question doesn't represent genetic mosaics.
The second question only serves to say that every male in the village is either homosexual or bisexual.
Go play "Professor Layton".
[Edit]
"Tell me if it's correct?"
Do you interpret "proof of guilt" as "no proof of innocence"?
[/Edit]
Soma
Last edited by phantomotap; 08-30-2009 at 01:26 AM.
Assuming the other people involved in the cheating do not confess....Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announce that at least one husband has been unfaithful. What happens?
Nothing, unless only one woman did not know a husband has been cheating ( in which case she kills her husband).
Because if more than one husband has been cheating the wives can not prove who it was as they all would know a husband has cheated at some point.
If only one cheated it will be obvious to the wife as she has not known a husband was cheating (when all the other wives already knew).
EDIT: Misread the question.
Still nothing because if the wives have not killed their husbands already (when the discrete event of the queen's announcement happens) they have themselves disobeyed the law (to kill their husbands the day of the cheating).
Unless all 100 husbands cheated earlier that day...
Last edited by novacain; 08-30-2009 at 03:45 AM.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
This is a statistical estimation, not a factual example (there are no numbers quoted in the original post for population or normal boy/girl ratio) and as such fractions to determine the weight of each outcome is perfectly valid.
Also pointing out you have assumed an exactly equal chance of a boy or girl, which is not a given in the question (nor is it exactly correct in reality).
If Mike Tyson and Bill Gates had a boxing match there are two outcomes, Mike wins or Bill wins. I do not think that equates to a 50% of Bill Gates getting his ear bitten off.
Last edited by novacain; 08-30-2009 at 02:29 AM.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
As I said, it was not informative because you failed to write good variable names, thus making it a mess instead of informative. Had you entered variable names, then yes, it would have been informative, albeit still flawed (you admitted it yourself that it has its limits).
I did miss that one.But... 100 families? Maybe you should read before you complain. Nowhere there was an initial number of 100 families.
I have read the formulas, and they do make sense, but they cannot be applied to any real-world situation, unfortunately, and that is why I'm rejecting their use.Yes, I made a mistake in that post. But you've seemed to make a dozen already, if you're not trolling, which I'm not used to from you. It seems to me you just didn't read the posts properly. But I propose you read them properly before you complain about a legit statement being invalid.
Or criticizing code that was never even meant to be good or readable, just to show the number my result converges to. And even if I didn't write it, if you'd actually read my formula I posted above that, I'd think you'd find the program fairly easy to understand.
Note that I never said that I believe in statistical mathematics, but there's just no way there is a 50/50 chance where you have two numbers, etc.
Unfortunately, there's also no other way of calculating it.
These sound like questions from a Google Job Interview
Spidey out!