A381055 a(n) = -n/2 if n is even, 3n + 1 if n is odd.
0, 4, -1, 10, -2, 16, -3, 22, -4, 28, -5, 34, -6, 40, -7, 46, -8, 52, -9, 58, -10, 64, -11, 70, -12, 76, -13, 82, -14, 88, -15, 94, -16, 100, -17, 106, -18, 112, -19, 118, -20, 124, -21, 130, -22, 136, -23, 142, -24, 148, -25, 154, -26, 160, -27, 166, -28, 172
Offset: 0
Examples
a(0) = -0/2 = 0; a(1) = 3*1 + 1 = 4; a(10) = -10/2 = -5.
Links
- Ya-Ping Lu, A plot of a(n)
- Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
Programs
-
Mathematica
a[n_]:=If[EvenQ[n],-n/2,3n+1];Array[a,58,0] (* James C. McMahon, Apr 30 2025 *)
-
Python
def A381055(n): return 3*n+1 if n%2 else -n>>1
Formula
a(n) = (-1)^(n+1)*A006370(n).
a(n) = (1/4)*((-1)^(n+1)*(7*n+2)+5*n+2).
G.f.: x*(2*x^2-x+4)/((x-1)^2*(x+1)^2). - Alois P. Heinz, Aug 13 2025
Comments