OFFSET
1,1
COMMENTS
Use algorithm: when a(n)=2k+1 2k+1 -> 4k+2, 4k, 4k-2, 4k-4, ...-> 2k+2 -> *2-> 4k+4 +2-> 4k+6 -> /2-> 2k+3, 2k+5, +2... ->4k+7. This covers all numbers between 2k+1 and 4k+7 and then the algorithm can be reapplied.
LINKS
FORMULA
a(n) = n if and only if n is a positive term of A168616. Also, for j > 2, a(n) < a(2^j - 5) if and only if n < 2^j - 5. - Rick L. Shepherd, May 22 2016
PROG
(PARI) {get_next_stage(v) = local(k = (v[#v] - 1)/2);
forstep(m = 2*v[#v], 2*k + 2, -2, v = concat(v, m));
v = concat(v, [2*v[#v], 4*k + 6]);
forstep(m = v[#v]/2, 4*k + 7, 2, v = concat(v, m)); v}
a = [2, 1, 3]; \\ code assumes last entry here is odd.
\\ n-th call to function returns 2^(n + 2) more terms
while (#a < 59, a = get_next_stage(a)); a \\ Rick L. Shepherd, May 21 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Toby Chamberlain, Jan 28 2016
STATUS
approved