%I #25 May 31 2023 22:36:07
%S 3,10,5,16,8,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,
%T 2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,
%U 1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1,4,2,1
%N 3x+1 sequence beginning at 3.
%D C. A. Pickover, The Math Book, Sterling, NY, 2009; see p. 374.
%H Colin Barker, <a href="/A033478/b033478.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).
%F From _Colin Barker_, Oct 04 2019: (Start)
%F G.f.: (3 + 10*x + 5*x^2 + 13*x^3 - 2*x^4 - x^5 - 14*x^6 - 7*x^7) / ((1 - x)*(1 + x + x^2)).
%F a(n) = a(n-3) for n>7.
%F (End)
%p f:=proc(n) if n mod 2 = 0 then n/2 else 3*n+1; fi; end; g:=proc(n) local i,t1; t1:=[n]; for i from 1 to 120 do t1:=[op(t1),f(t1[nops(t1)])]; od; t1; end; g(3);
%t A033478list[nmax_]:=PadRight[{3,10,5,16,8},nmax+1,{2,1,4}];A033478list[100] (* _Paolo Xausa_, May 31 2023 *)
%o (PARI) a(n)=if(n>4,[2,1,4][n%3+1],[3,10,5,16,8][n+1]) \\ _Charles R Greathouse IV_, Jun 22 2016
%o (PARI) Vec((3 + 10*x + 5*x^2 + 13*x^3 - 2*x^4 - x^5 - 14*x^6 - 7*x^7) / ((1 - x)*(1 + x + x^2)) + O(x^80)) \\ _Colin Barker_, Oct 04 2019
%Y Row 3 of A347270.
%K nonn,easy
%O 0,1
%A _Jeff Burch_