login
A335552
Triangle T(n,k) read by rows: in the Josephus problem with n initial numbers on a line: eliminate each second and reverse left-right-direction of elimination. T(n,k) is the (n-k+1)st element removed, 1<=k<=n.
1
1, 3, 1, 3, 1, 4, 1, 5, 3, 4, 1, 5, 3, 6, 4, 3, 7, 1, 5, 6, 4, 3, 7, 1, 5, 8, 6, 4, 9, 1, 5, 3, 7, 8, 6, 4, 9, 1, 5, 3, 7, 10, 8, 6, 4, 11, 3, 7, 1, 5, 9, 10, 8, 6, 4, 11, 3, 7, 1, 5, 9, 12, 10, 8, 6, 4, 9, 1, 13, 5, 3, 7, 11, 12, 10, 8, 6, 4, 9, 1, 13, 5, 3, 7, 11, 14, 12, 10, 8, 6, 4, 11, 3, 15
OFFSET
1,2
LINKS
K. Matsumoto, T. Nakamigawa, M. Watanabe, On the switchback vertion of Josephus Problem, Yokohama Math. J. 53 (2007) 83, function f_k(n).
EXAMPLE
The triangle starts
1
3 1
3 1 4
1 5 3 4
1 5 3 6 4
3 7 1 5 6 4
3 7 1 5 8 6 4
9 1 5 3 7 8 6 4
9 1 5 3 7 10 8 6 4
11 3 7 1 5 9 10 8 6 4
11 3 7 1 5 9 12 10 8 6 4
9 1 13 5 3 7 11 12 10 8 6 4
9 1 13 5 3 7 11 14 12 10 8 6 4
11 3 15 7 1 5 9 13 14 12 10 8 6 4
11 3 15 7 1 5 9 13 16 14 12 10 8 6 4
1 17 9 13 5 3 7 11 15 16 14 12 10 8 6 4
1 17 9 13 5 3 7 11 15 18 16 14 12 10 8 6 4
3 19 11 15 7 1 5 9 13 17 18 16 14 12 10 8 6 4
3 19 11 15 7 1 5 9 13 17 20 18 16 14 12 10 8 6 4
MAPLE
sigr := proc(n, r)
floor(n/2^r) ;
end proc:
f := proc(n)
local ndigs, fn, k ;
ndigs := convert(n, base, 2) ;
fn := 0 ;
for k from 2 to nops(ndigs) by 2 do
fn := fn+op(k, ndigs)*2^(k-1)
end do;
fn ;
end proc:
g := proc(t, n)
local r;
if t =1 then
0 ;
elif t > 1 then
r := ilog2( (n-1)/(t-1) ) ;
(-2)^r*(f( sigr(2*n-1, r) )+f( sigr(n-1, r) )-2*t+3) ;
end if;
end proc:
ft := proc(t, n)
f(n-1)+1+g(t, n) ;
end proc:
for n from 1 to 20 do
for t from 1 to n-1 do
printf("%3d ", ft(t, n)) ;
end do:
printf("\n") ;
end do:
CROSSREFS
Cf. A090569 (column k=1).
Sequence in context: A373031 A274473 A280526 * A306841 A095660 A290080
KEYWORD
nonn,tabl
AUTHOR
R. J. Mathar, Jun 22 2020
STATUS
approved