OFFSET
1,2
COMMENTS
By the rules of the (3*n+1)-problem, an even number can appear either by the operation 3*x+1 only when x is an odd number or by the division of a number of the form 4*k by 2.
Using induction as in the proof of the Theorem in A261728, one can prove that if n == 0(mod 6), then a(n) = 2*n-2; if n == 2(mod 6), then a(n) = 2*n; if n == 4(mod 6), then a(n) = n-2.
The sequence is a permutation of the positive integers not divisible by 6 (A047253).
LINKS
Peter J. C. Moses, Table of n, a(n) for n = 1..10000
FORMULA
a(2*n-1) = 2*n-1, for n>=1.
a(6*k) = 12*k-2, a(6*k+2) = 12*k+4 and a(6*k+4) = 6*k+2, for k>=0.
O.g.f.:(1+x (4+x (3+x (2+x (5+x (10+x (5+x (8+x (3+x (4+x (1+2 x)))))))))))/(-1+x^6)^2.
EXAMPLE
Let n=28. Since 28 is of the form 6*k+4 with k=4, then a(28) = 6*4+2 = 26.
MATHEMATICA
a[n_] := If[OddQ[n], n, Switch[Mod[n, 6], 0, 2n-2, 2, 2n, 4, n-2]]; Array[a, 81] (* Jean-François Alcover, Sep 02 2015, from given formula *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Sep 02 2015
STATUS
approved