OFFSET
1,3
COMMENTS
Inspired by A266569.
In other words, a(n) = n/2 + a(n/2) if n even, a(n) = 3n+1+a(3n+1) if n odd.
From Seiichi Manyama, Apr 25 2016: (Start)
This sequence was inspired by the Collatz problem (A006577).
The Collatz rule is as follows: If n is even, divide it by 2, otherwise multiply it by 3 and add 1 (A006370).
For example, starting with n = 3, one gets the sequence 3, 10, 5, 16, 8, 4, 2, 1. So a(3) = 10 + 5 + 16 + 8 + 4 + 2 + 1 = 46. (End) [Comment edited by N. J. A. Sloane, Apr 25 2016]
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..20000
Seiichi Manyama, Table of n, a(n) for n = 1..650289
MAPLE
PROG
(PARI) a(n) = my(ret=n-1); while((n>>=valuation(n, 2)) > 1, ret+=5*n+2; n=3*n+1); ret; \\ Kevin Ryde, Dec 10 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Apr 08 2016
EXTENSIONS
Typo in definition corrected by Gionata Neri, Apr 08 2016
STATUS
approved