[seqfan] Re: the revolver sequence

Tanya Khovanova mathoflove-seqfan at yahoo.com
Thu Sep 24 16:23:50 CEST 2009


Thank you Max,

As always great coding!

My definition of this sequence should be clarified:
1. The shooter spins before the first shot.
2. I do not count the case when the revolver is completely loaded.

My goal was to reproduce the case in the famous problem with 6 chambers and 2 adjacent bullets, as it is for many surprising that it is better to spin after the first shot.

Tanya

--- On Wed, 9/23/09, Max Alekseyev <maxale at gmail.com> wrote:

> From: Max Alekseyev <maxale at gmail.com>
> Subject: [seqfan] Re: the revolver sequence
> To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
> Date: Wednesday, September 23, 2009, 11:12 PM
> Thanks for explicit example - I've
> found a typo in my code.
> 
> Here is a formula and first 50 terms of your sequence:
> 
> { a(n) = sum(z=0,n,sum(r=1,min(ceil(z-z^2/n)-1,n-z),
> sumdiv(gcd([n,z,r]),d, eulerphi(d) * binomial(z/d - 1, r/d
> - 1) *
> binomial((n-z)/d - 1, r/d - 1) )/r )) }
> 
> ? vector(50,n,a(n))
> %2 = [0, 0, 0, 0, 2, 3, 4, 5, 18, 43, 60, 84, 294, 472,
> 724, 1077,
> 3504, 5807, 10396, 15944, 43664, 84308, 137004, 217728,
> 582966,
> 1134304, 1883360, 3225812, 8964134, 15461472, 27796942,
> 45814765,
> 123307634, 233218013, 396304692, 663041846, 1754000726,
> 3300299482,
> 5679338110, 9942238090, 24989323012, 47334027696,
> 85892508384,
> 146496196464, 359597562016, 690754558978, 1256104705128,
> 2163505451106, 5289200995480, 10102216102758]
> 
> Regards,
> Max
> 
> On Wed, Sep 23, 2009 at 10:25 PM, Tanya Khovanova
> <mathoflove-seqfan at yahoo.com>
> wrote:
> > This is my list for n=9:
> >
> > {{0, 0, 0, 0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 1, 1,
> 1}, {0, 0, 0,
> >  0, 0, 1, 1, 1, 1}, {0, 0, 0, 0, 1, 0, 1, 1, 1},
> {0, 0, 0, 0, 1, 1,
> >  0, 1, 1}, {0, 0, 0, 0, 1, 1, 1, 0, 1}, {0, 0, 0,
> 1, 0, 0, 1, 1,
> >  1}, {0, 0, 0, 1, 1, 0, 0, 1, 1}, {0, 0, 0, 1, 1,
> 1, 0, 0, 1}, {0, 0,
> >   0, 0, 1, 1, 1, 1, 1}, {0, 0, 0, 1, 0,
> 1, 1, 1, 1}, {0, 0, 0, 1, 1,
> >  0, 1, 1, 1}, {0, 0, 0, 1, 1, 1, 0, 1, 1}, {0, 0,
> 0, 1, 1, 1, 1, 0,
> >  1}, {0, 0, 1, 0, 0, 1, 1, 1, 1}, {0, 0, 1, 1, 0,
> 0, 1, 1, 1}, {0, 0,
> >   0, 1, 1, 1, 1, 1, 1}, {0, 0, 1, 1, 1,
> 1, 1, 1, 1}}
> >
> > --- On Wed, 9/23/09, Max Alekseyev <maxale at gmail.com>
> wrote:
> >
> >> From: Max Alekseyev <maxale at gmail.com>
> >> Subject: [seqfan] Re: the revolver sequence
> >> To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
> >> Date: Wednesday, September 23, 2009, 6:58 PM
> >> Hi Tanya,
> >>
> >> I've got different values starting with a(9) = 13,
> a(10) =
> >> 32 etc.
> >> Could you please double check your values or lists
> all 18
> >> ways of
> >> loading a revolver with n=9 chambers?
> >>
> >> Thanks,
> >> Max
> >>
> >> On Wed, Sep 23, 2009 at 5:06 PM, Tanya Khovanova
> >> <mathoflove-seqfan at yahoo.com>
> >> wrote:
> >> > Hello all,
> >> >
> >> > I just submitted a sequence related to the
> revolver
> >> puzzle:
> >> > http://blog.tanyakhovanova.com/?p=174
> >> >
> >> > I generalized it to revolvers having n
> chambers.
> >> >
> >> > I think there should be more sequences: for
> example,
> >> the one when it is preferable to spin and the one
> when the
> >> chances are the same.
> >> >
> >> > Also, my programs are usually not very
> efficient. It
> >> will be nice if someone can add more terms to
> this
> >> sequence.
> >> >
> >> > %I A165646
> >> > %S A165646
> 0,0,0,0,2,3,4,5,18,43,60,84,294,472,724
> >> > %N A165646 The revolver sequence.
> >> > %C A165646 a(n) is in how many ways you can
> load a
> >> revolver with n chambers, so that if a person
> survives after
> >> the first shot, he/she has better chances of
> survival for
> >> the second shot if the shooter continues rather
> than spins.
> >> a(n) <= A000031(n) as A000031(n) counts the
> number of
> >> possible revolver loadings.
> >> > %H A165646 Tanya Khovanova, <a href="http://blog.tanyakhovanova.com/?p=174">Heard on the
> >> Street</a>
> >> > %e A165646 Based on the famous interview
> question
> >> where the revolver has six chambers and the
> shooter loads
> >> two adjacent bullets. As the answer to this
> question is to
> >> continue, a(6) must be at least 1.
> >> > %t A165646 << Combinatorica` colors[x_]
> :=
> >> Table[PadLeft[Table[1, {n, i}], x], {i, 0, x}]
> >> continueBetter[list_] := (len = Length[list]; c0 =
> 0; c00 =
> >> 0; rotateN = 0; While[rotateN < len, newList =
> >> RotateLeft[list, rotateN]; If[newList[[1]] == 0,
> c0++;
> >> If[newList[[2]] == 0, c00++]]; rotateN++]; If[c0
> > 0,
> >> c00/c0 > c0/len, False]) continueNum[num_] :=
> (neckNum =
> >> Length[colors[num]]; ans = 0; count = 1;
> While[count <=
> >> neckNum, ans = ans +
> Length[Select[ListNecklaces[num,
> >> colors[num][[count]], Cyclic], continueBetter[#]
> &]];
> >> count++]; ans) Table[continueNum[n], {n, 2, 15}]
> >> > %Y A165646 A000031
> >> > %K A165646 more,nonn
> >> > %O A165646 1,5
> >> > %A A165646 Tanya Khovanova
> (tanyakh(AT)yahoo.com), Sep
> >> 23 2009
> >> >
> >> >
> >> >
> >> >
> _______________________________________________
> >> >
> >> > Seqfan Mailing list - http://list.seqfan.eu/
> >> >
> >>
> >>
> >> _______________________________________________
> >>
> >> Seqfan Mailing list - http://list.seqfan.eu/
> >>
> >
> >
> > _______________________________________________
> >
> > Seqfan Mailing list - http://list.seqfan.eu/
> >
> 
> 
> _______________________________________________
> 
> Seqfan Mailing list - http://list.seqfan.eu/
> 




More information about the SeqFan mailing list