login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A091829 a(1)=1; a(2n)=a(n)+1, a(2n+1)=a(n) mod 2. 1
1, 2, 1, 3, 0, 2, 1, 4, 1, 1, 0, 3, 0, 2, 1, 5, 0, 2, 1, 2, 1, 1, 0, 4, 1, 1, 0, 3, 0, 2, 1, 6, 1, 1, 0, 3, 0, 2, 1, 3, 0, 2, 1, 2, 1, 1, 0, 5, 0, 2, 1, 2, 1, 1, 0, 4, 1, 1, 0, 3, 0, 2, 1, 7, 0, 2, 1, 2, 1, 1, 0, 4, 1, 1, 0, 3, 0, 2, 1, 4, 1, 1, 0, 3, 0, 2, 1, 3, 0, 2, 1, 2, 1, 1, 0, 6, 1, 1, 0, 3, 0, 2, 1, 3, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
n>0 a(2*A059009(n)+1)=0; n>0 a(n) mod 2 = 1-A059448(n); a(2^n)=n+1
MAPLE
f:= proc(n) option remember;
if n::even then procname(n/2)+1 else procname((n-1)/2) mod 2 fi
end proc:
f(1):= 1:
map(f, [$1..100]); # Robert Israel, Jan 22 2018
MATHEMATICA
a[1] = 1;
a[n_] := a[n] = If[OddQ[n], Mod[a[n-1]+1, 2], a[n/2]+1];
Array[a, 100] (* Jean-François Alcover, Aug 26 2020 *)
PROG
(PARI) a(n)=if(n<2, 1, if(n%2, (a(n-1)+1)%2, a(n/2)+1))
CROSSREFS
Sequence in context: A308881 A281488 A071461 * A194188 A104512 A131848
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Mar 09 2004
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 09:59 EDT 2024. Contains 371268 sequences. (Running on oeis4.)