OFFSET
0,3
COMMENTS
Positive terms indicate the next odd number 2m+1 in the trajectory is greater than 2n+1 which is the case every second time giving a(n) = m-n = (n+1)/2.
Negative terms indicate the next odd number 2m+1 in the trajectory is smaller than 2n+1. For behavior of this part refer to A087230.
LINKS
Ruud H.G. van Tol, Table of n, a(n) for n = 0..20000
Ruud H.G. van Tol, Perl program
FORMULA
a(n) = ((6*n+4)/2^A087230(n) - (2*n+1))/2.
EXAMPLE
a(14)=-9 because 2*14 + 1 = 29 and the Collatz trajectory to reach the next odd number goes: 29, 88, 44, 22, 11. Thus, m=5 and 5 - 14 = -9.
MAPLE
f:= proc(n) local m;
m:= 6*n+4;
m/2^(1+padic:-ordp(m, 2))-n-1/2
end proc:
map(f, [$0..100]); # Robert Israel, Mar 22 2020
MATHEMATICA
a[n_] := ((6n+4)/2^IntegerExponent[6n+4, 2] - (2n+1))/2;
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 15 2023 *)
PROG
(PARI) forstep(n=0, 1000, 1, m=6*n+4; print1(((m/2^valuation(m, 2)-(2*n+1))/2), ", "))
CROSSREFS
KEYWORD
AUTHOR
K. G. Stier, Aug 26 2014
STATUS
approved