cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A090569 The survivor w(n,2) in a modified Josephus problem, with a step of 2.

This page as a plain text file.
%I A090569 #28 Jan 30 2023 09:40:35
%S A090569 1,1,3,3,1,1,3,3,9,9,11,11,9,9,11,11,1,1,3,3,1,1,3,3,9,9,11,11,9,9,11,
%T A090569 11,33,33,35,35,33,33,35,35,41,41,43,43,41,41,43,43,33,33,35,35,33,33,
%U A090569 35,35,41,41,43,43,41,41,43,43,1,1,3,3,1,1,3,3,9,9,11,11,9,9,11,11,1,1
%N A090569 The survivor w(n,2) in a modified Josephus problem, with a step of 2.
%C A090569 Arrange n persons {1,2,...,n} consecutively on a line rather than around in a circle. Beginning at the left end of the line, we remove every q-th person until we reach the end of the line. At this point we immediately reverse directions, taking care not to "double count" the person at the end of the line and continue to eliminate every q-th person, but now moving right to left. We continue removing people in this back-and-forth manner until there remains a lone survivor w(n,q).
%C A090569 Or a(n) is in A145812 such that 2n+1-2a(n) is in A145812 as well. Note also that 2a(n)+A088442(n-1)=2n+1. - _Vladimir Shevelev_, Oct 20 2008
%H A090569 Chris Groƫr, <a href="http://www.jstor.org/stable/3647800">The Mathematics of Survival: From Antiquity to the Playground</a>, Amer. Math. Monthly, 110 (No. 9, 2003), 812-825.
%H A090569 <a href="/index/J#Josephus">Index entries for sequences related to the Josephus Problem</a>
%F A090569 w(n, 2) = 1 + Sum_{odd j=1..k} b(j)*(2^j), where Sum_{j=0..k} b(j)*(2^j) is the binary expansion of either n or n-1, whichever is odd.
%F A090569 a(n) = A063695(n-1) + 1.
%e A090569 a(2)=11, since people are eliminated in the order 2, 4, 6, 8, 10, 12, 9, 5, 1, 7, 3, leaving 11 as the survivor.
%o A090569 (Python)
%o A090569 def A090569(n): return (n-1&((1<<(m:=(n-1).bit_length())+(m&1^1))-1)//3)+1 # _Chai Wah Wu_, Jan 30 2023
%Y A090569 Cf. A088443, A088452.
%K A090569 nonn
%O A090569 1,3
%A A090569 _John W. Layman_, Dec 02 2003