OFFSET
1,2
COMMENTS
a(n) = n for all odd n.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
FORMULA
Recurrence: a(1)=1; then a(2n)=a(n)+1, a(2n+1)=2n+1. - Benoit Cloitre, Jun 04 2007
EXAMPLE
a(12) = 5.
MATHEMATICA
Table[n/2^# + # & [IntegerExponent[n, 2]], {n, 100}] (* Paolo Xausa, Jul 24 2024 *)
PROG
(PARI) a(n)=if(n<2, 1, if(n%2, n, a(n/2)+1)) \\ Benoit Cloitre, Jun 04 2007
(PARI) a(n)=n/2^valuation(n, 2)+valuation(n, 2) \\ Ralf Stephan, Jul 07 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Mirko Rahn (rahn(AT)ira.uka.de), Jun 12 2006
STATUS
approved