%I #51 Mar 17 2023 07:23:32
%S 1,1,1,3,4,4,3,1,7,3,9,3,9,1,7,13,2,8,14,20,5,11,17,23,4,10,16,22,28,
%T 4,10,16,22,28,34,4,10,16,22,28,34,40,3,9,15,21,27,33,39,45,51,5,11,
%U 17,23,29,35,41,47,53,59,3,9,15,21,27,33,39,45,51,57,63,69,1,7,13,19,25
%N A version of the Josephus problem: a(n) is the surviving integer under the following elimination process. Arrange 1,2,3,...,n in a circle, increasing clockwise. Starting with i=1, delete the integer 5 places clockwise from i. Repeat, counting 5 places from the next undeleted integer, until only one integer remains.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Josephus_problem">Josephus problem</a>.
%H <a href="/index/J#Josephus">Index entries for sequences related to the Josephus Problem</a>.
%F a(n) = (a(n-1) + 5) mod n + 1 if n > 1, a(1) = 1.
%e a(7) = 3 because the elimination process gives (^1,2,3,4,5,6,7) -> (1,2,3,4,5,^7) -> (1,2,3,4,^7) -> (^1,2,3,4) -> (1,^3,4) -> (^3,4) -> (3), where ^ denotes the counting reference position.
%e a(13) = 9 => a(14) = (a(13) + 5) mod 14 + 1 = 1.
%t a[1] = 1; a[n_] := a[n] = Mod[a[n - 1] + 5, n] + 1; Array[a, 100] (* _Amiram Eldar_, Feb 03 2023 *)
%o (Python)
%o def A360268_up_to_n(n):
%o val = 1
%o return [val := (val + 5) % i + 1 for i in range(1,n+1)]
%Y 6th column of A198789.
%Y Cf. A006257, A054995, A088333, A181281.
%K nonn
%O 1,4
%A _Benjamin Lilley_, Jan 31 2023