Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #12 Mar 22 2021 17:22:38
%S 3,22,11,78,39,274,137,960,480,240,120,60,30,15,106,53,372,186,93,652,
%T 326,163,1142,571,3998,1999,13994,6997,48980,24490,12245,85716,42858,
%U 21429,150004,75002,37501,262508,131254,65627,459390,229695,1607866,803933
%N Trajectory of 3 under map n->7n+1 if n odd, n->n/2 if n even.
%H Robert Israel, <a href="/A037101/b037101.txt">Table of n, a(n) for n = 0..10000</a>
%p a:= proc(n) option remember; local v;
%p v:= procname(n-1);
%p if v::odd then 7*v+1 else v/2 fi
%p end proc:
%p a(0):= 3:
%p map(a, [$0..100]); # _Robert Israel_, Jan 24 2020
%t nxt[n_]:=If[OddQ[n],7n+1,n/2]; NestList[nxt,3,40] (* _Harvey P. Dale_, Jun 05 2012 *)
%o (Python)
%o def iter(n): return 7*n+1 if n%2 == 1 else n//2
%o def aupton(terms):
%o alst = [3]
%o for n in range(1, terms+1): alst.append(iter(alst[-1]))
%o return alst
%o print(aupton(43)) # _Michael S. Branicky_, Mar 22 2021
%Y Cf. A063871.
%K nonn
%O 0,1
%A _N. J. A. Sloane_.