Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #14595

Re: Toughest Probability Question

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Tue, 13 Dec 2011 20:52:11 -0600
Message-ID <4EE80F5B.6116@mindspring.com> (permalink)
Date Tue, 13 Dec 2011 21:52:11 -0500
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: Toughest Probability Question
References <9cb0f967-18d1-410c-9074-f4d84858d9af@u10g2000prl.googlegroups.com> <4EE69C7E.12EB@mindspring.com> <slrnjedm5u.2as3.usenet-nospam@guild.seebs.net> <4EE78837.2A2C@mindspring.com> <4EE79757.5BD4@mindspring.com> <19bfb44b-e01d-4a35-910c-783738ee2fa4@d17g2000prl.googlegroups.com>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 45
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.156.228.63
X-Trace sv3-0ikrHcFbZqoSn7Pa4VHweLHYGRnpSyctUxXXkEQiKbMmiPB8KaEXmIxRKXXYjLtIuhk6qfxjzhtkpUe!AnUQChLU7Ck05GOzaM6qwlITHspox9ChdYZKUR7VvtXbN7LRMCfzNJAE0ujXHf2t93sJRf3+ud3T!+0MZMAAskA==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2307
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:14595

Show key headers only | View raw


Peter Nilsson wrote:
> 
> > pete wrote:
> > I had it right the first time,
> > but I rewrote the whole thing anyway.
> > ...
> > #define YEAR                365  /* 366 */
> 
> To nitpick, this is limiting people to those only born in non
> leap years, or those only born in leap years. The general figure
> is somewhere in between...
> 
>   #include <stdio.h>
> 
>   double P2(int f29, int oth, int n)
>   {
>     double p = 0;
>     if (n == 0) return 1;
>     if (oth < 365)
>       p += (303. / 400 + 97. / 400 * 365 / 366)
>          * (365 - oth) / 365 * P2(f29, oth + 1, n - 1);
>     if (f29 < 1)
>       p += 97. / 400 * 1 / 366 * P2(f29 + 1, oth, n - 1);
>     return p;
>   }
> 
>   double P(int n) { return P2(0, 0, n); }
> 
>   int main(void)
>   {
>     int n = 0;
>     double p;
> 
>     do {
>       p = P(++n);
>       printf("%3d: %7.3f%%\n", n, 100 * (1 - p));
>     }  while (1 - p < .5);
> 
>     return 0;
>   }

I was wondering about how to deal with that.

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-12 19:29 -0500
  Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 04:46 +0000
    Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-12 22:19 -0800
      Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 09:19 +0000
        Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 13:43 +0000
          Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 10:27 -0800
            Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 19:52 +0000
              Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 20:06 +0000
              Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 12:14 -0800
                Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 23:34 +0000
                Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 00:24 +0000
          Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 19:27 +0000
            Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 23:56 +0000
              Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 00:24 +0000
                Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-14 12:12 +0000
                Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 17:47 +0000
                Re: Toughest Probability Question gordonb.qunma@burditt.org (Gordon Burditt) - 2011-12-15 08:22 -0600
                Re: Toughest Probability Question Robert Wessel <robertwessel2@yahoo.com> - 2011-12-15 14:41 -0600
                Re: Toughest Probability Question superpollo <superpollo@tznvy.pbz> - 2011-12-15 19:14 +0100
                Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-14 13:12 -0800
                Re: Toughest Probability Question Willem <willem@toad.stack.nl> - 2011-12-14 21:53 +0000
                Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-14 22:35 +0000
                Re: Toughest Probability Question Willem <willem@toad.stack.nl> - 2011-12-15 09:07 +0000
                Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-15 02:07 -0800
                Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-15 12:13 -0800
                Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-15 13:03 -0800
                Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-15 21:36 +0000
              Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-13 16:35 -0800
                Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 01:20 +0000
              Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 16:44 -0800
                Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 01:20 +0000
                Re: Toughest Probability Question James Dow Allen <jdallen2000@yahoo.com> - 2011-12-15 02:33 -0800
                Re: Toughest Probability Question gwowen <gwowen@gmail.com> - 2011-12-15 05:38 -0800
                Re: Toughest Probability Question Thad Smith <ThadSmith@acm.org> - 2011-12-18 23:34 -0700
                Re: Toughest Probability Question Bill Reid <hormelfree@gmail.com> - 2011-12-14 07:07 -0800
    Re: Toughest Probability Question Kaz Kylheku <kaz@kylheku.com> - 2011-12-13 06:55 +0000
      Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 09:19 +0000
    Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 12:15 -0500
      Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 13:20 -0500
        Re: Toughest Probability Question Peter Nilsson <airia@acay.com.au> - 2011-12-13 18:15 -0800
          Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 21:52 -0500

csiph-web