OFFSET
0,1
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
MAPLE
a:= proc(n) option remember; local v;
v:= procname(n-1);
if v::odd then 7*v+1 else v/2 fi
end proc:
a(0):= 3:
map(a, [$0..100]); # Robert Israel, Jan 24 2020
MATHEMATICA
nxt[n_]:=If[OddQ[n], 7n+1, n/2]; NestList[nxt, 3, 40] (* Harvey P. Dale, Jun 05 2012 *)
PROG
(Python)
def iter(n): return 7*n+1 if n%2 == 1 else n//2
def aupton(terms):
alst = [3]
for n in range(1, terms+1): alst.append(iter(alst[-1]))
return alst
print(aupton(43)) # Michael S. Branicky, Mar 22 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved