login
A357564
a(n) = n - 2*b(b(n)) for n >= 2, where b(n) = A006165(n).
2
0, 1, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 17, 18, 19, 20, 21, 22, 23
OFFSET
2,3
COMMENTS
a(n+1) - a(n) is equal to 1 or -1.
The following hold for k >= 0:
Local valley: at n = 5*(2^k) the sequence has a local minimum value of 2^k.
Ascent: on the interval [5*(2^k), 8*(2^k)] of length 3*(2^k) the line graph of the sequence has slope 1.
Local peak: at n = 8*(2^k) the sequence has a local maximum value of 4*(2^k).
Descent: on the interval [8*(2^k), 10*(2^k)] of length 2*(2^k) the line graph of the sequence has slope -1.
Local valley: at n = 10*(2^k) = 5*(2^(k+1)) the sequence has a local minimum value of 2^(k+1).
FORMULA
a(2) = 0, a(3) = 1 and a(4) = 2. For k >= 0 there holds
a(5*2^k + j) = 2^k + j for 0 <= j <= 3*2^k and
a(8*2^k + j) = 4*2^k - j for 0 <= j <= 2*2^k.
MAPLE
# b(n) = A006165(n)
b := proc(n) option remember; if n = 1 then 1 else n - b(n - b(b(n-1))) end if; end proc:
seq( n - 2*b(b(n)), n = 2..100);
CROSSREFS
Sequence in context: A175792 A196686 A213088 * A169809 A214962 A350809
KEYWORD
nonn,easy
AUTHOR
Peter Bala, Oct 15 2022
STATUS
approved