# Josephus problem?

N. J. A. Sloane njas at research.att.com
Wed Apr 23 07:13:32 CEST 2003

```aargh!

here's a better version:

%I A005428 M0572
%S A005428 1,1,2,3,4,6,9,14,21,31,47,70,105,158,237,355,533,799,1199,1798,2697,4046,6069,9103,
%T A005428 13655,20482,30723,46085,69127,103691,155536,233304,349956,524934,787401
%N A005428 a(0) = 1, state(0) = 2; for n >= 1, if a(n-1) is even then a(n) = floor( 3*a(n-1)/2 ) and state(n) = state(n-1), if a(n-1) is odd and state(n-1) = 1 then a(n) = ceiling( 3*a(n-1)/2)
and state(n) = 3 - state(n-1), and if a(n-1) is odd and state(n-1) = 2 then a(n) = floor( 3*a(n-1)/2) and state(n) = 3 - state(n-1).
%C A005428 Arises from a version of the Josephus problem: start with n people, sequence gives set of n where, if every 3rd person drops out, either it's person #1 or #2 who is left at the end.
%D A005428 K. Burde, Das Problem der Abzahlreime und Zahlentwicklungen mit gebrochenen Basen, J. Number Theory 26 (1987), no. 2, 192-209.
%D A005428 F. Schuh, The Master Book of Mathematical Recreations. Dover, NY, 1968, page, 374, Table 18, union of columns 1 and 2 (which are A081614 and A081615).
%Y A005428 Cf. A005427. Union of A081614 and A081615.
%Y A005428 Is this the same as log2(A082125(n+3))?. - Ralf Stephan (ralf(AT)ark.in-berlin.de), Apr 16 2002
%Y A005428 Is this the same as A073941? - Benoit Cloitre, Nov 24, 2002
%K A005428 nonn,more,easy
%O A005428 0,2
%A A005428 njas and Simon Plouffe (plouffe(AT)math.uqam.ca)
%E A005428 Entry revised Apr 23, 2003.

%I A081614
%S A081614 1,4,6,9,31,70,105
%N A081614 Subsequence of A005428 with state = 1.
%Y A081614 Cf. A005428, A081615.
%K A081614 nonn,easy,more,new
%O A081614 0,2
%A A081614 njas, Apr 23 2003

%I A081615
%S A081615 1,2,3,14,21,47,158,237
%N A081615 Subsequence of A005428 where state = 2.
%Y A081615 Cf. A005428, A081614.
%K A081615 nonn,easy,more,new
%O A081615 0,2
%A A081615 njas, Apr 23 2003

```