A343780 If n good guys followed by n bad guys stand in a circle, a(n) is the least q such that executing every q-th person gets all bad guys first.
2, 7, 5, 30, 169, 441, 1872, 7632, 1740, 93313, 459901, 1358657, 2504881, 13482720, 25779600, 68468401, 610346880, 1271932200, 327280800, 11605393800, 10071626400, 270022896000, 212719197601, 673534461600, 80276676481, 7618206526561, 14227357636801
Offset: 1
Keywords
Examples
For n = 2, we have four people; with q = 7 we count 1,2,3,4,1,2,3 and person 3 is eliminated. Next we count 4,1,2,4,1,2,4, so person 4 is eliminated, leaving only 1 and 2. Attempting this with any q < 7 does not eliminate 3 and 4 first.
References
- R. L. Graham, D. E. Knuth, O. Patashnik, Concrete Mathematics, Addison-Wesley, 1994, p. 20.
- W. W. Rouse Ball and H. S. M. Coxeter, Mathematical Recreations and Essays, Dover, 1987, pp. 32-36.
Links
- Bert Dobbelaere, Table of n, a(n) for n = 1..40
- P. Schumer, The Josephus Problem: Once More Around, Mathematics Magazine, Vol. 75:1 (2002), 12-17.
- Index entries for sequences related to the Josephus Problem
- Bert Dobbelaere, Python program
Crossrefs
Programs
-
Python
def A343780(n): q = 1 while True: s, c = [1]*n+[0]*n, 0 for i in range(n): c = (c+q)%(2*n-i) if s[c]: break s = s[:c]+s[c+1:] else: return q+1 q += 1 # Chai Wah Wu, Apr 30 2021
Extensions
a(17)-a(21) from Chai Wah Wu, Apr 30 2021
a(22) from Nicholas Matteo, Apr 30 2021
a(23)-a(25) from Jon E. Schoenfield, Apr 30 2021
a(26)-a(27) from Bert Dobbelaere, May 01 2021
Comments