

A165646


The revolver sequence.


0



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,5


COMMENTS

a(n) is the number of ways in which 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) gives the number of possible revolver loadings.


LINKS

Table of n, a(n) for n=1..36.
Tanya Khovanova, Heard on the Street


EXAMPLE

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.


MATHEMATICA

<< 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}]


PROG

(PARI) { a(n) = sum(z=0, n, sum(r=1, min(ceil(zz^2/n)1, nz), sumdiv(gcd([n, z, r]), d, eulerphi(d) * binomial(z/d  1, r/d  1) * binomial((nz)/d  1, r/d  1) )/r )) } \\ Max Alekseyev, Sep 25 2009


CROSSREFS

Cf. A000031.
Sequence in context: A337559 A061412 A295317 * A261639 A333993 A342617
Adjacent sequences: A165643 A165644 A165645 * A165647 A165648 A165649


KEYWORD

nonn,uned


AUTHOR

Tanya Khovanova, Sep 23 2009


EXTENSIONS

Extended by Max Alekseyev, Sep 25 2009


STATUS

approved



