OFFSET
1,2
LINKS
Georg Fischer, Table of n, a(n) for n = 1..1000
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:
# A063695
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
KEYWORD
nonn,tabl
AUTHOR
R. J. Mathar, Jun 22 2020
STATUS
approved