OFFSET
1,2
COMMENTS
a(n) is the sum of numbers in trajectory of Terras-modified Collatz problem with first number n.
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..10000
EXAMPLE
The 5th row of irregular triangle A070168 is [5, 8, 4, 2, 1] whose sum is 20. a(5) = 5 + 8 + 4 + 2 + 1 = 20.
MATHEMATICA
a[n_]:=If[n<2, 1, If[OddQ[n], (3n + 1)/2, n/2]]; Table[-1 + Plus @@ FixedPointList[a, n], {n, 100}]
PROG
(Python)
def a(n):
if n==1: return 1
l=[n]
while True:
if n%2==0: n//=2
else: n = (3*n + 1)//2
l.append(n)
if n<2: break
return sum(l)
print([a(n) for n in range(1, 101)])
CROSSREFS
KEYWORD
nonn
AUTHOR
Indranil Ghosh, Apr 17 2017
STATUS
approved