OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
MAPLE
a:= proc(n) option remember;
if n::even then 1+procname(n/2^padic:-ordp(n, 2)) else procname(n-1) fi
end proc:
a(1):= 1:
map(a, [$1..200]); # Robert Israel, Sep 09 2020
MATHEMATICA
Nest[Append[#1, If[EvenQ@ #2, 1 + #1[[#2/2^IntegerExponent[#2, 2]]], #1[[-1]] ]] & @@ {#, Length@ # + 1} &, {1}, 104] (* Michael De Vlieger, Sep 09 2020 *)
PROG
(PARI) a(n)=if(n<2, 1, if(n%2, a(n-1), a(n/2^valuation(n, 2))+1))
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 07 2003
STATUS
approved