The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A335599 Sequence is limit_{k->oo} s_k, where s_k = s_{k-1}, s_{k-1}[k-1] + 2^(k-1), ..., s_{k-1}[end] + 2^(k-1) starting with s_0 = s_0[0..1] = 0,0. 1
 0, 0, 1, 1, 2, 3, 3, 5, 5, 6, 7, 7, 9, 10, 11, 11, 13, 13, 14, 15, 15, 18, 19, 19, 21, 21, 22, 23, 23, 25, 26, 27, 27, 29, 29, 30, 31, 31, 35, 35, 37, 37, 38, 39, 39, 41, 42, 43, 43, 45, 45, 46, 47, 47, 50, 51, 51, 53, 53, 54, 55, 55, 57, 58, 59, 59, 61, 61 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,5 COMMENTS In binary 0, 0, 1, 1, 10, 11, 11, 101, 101, 110, 111, 111, 1001, 1010, 1011, 1101, 1110, 1111, 1111, 10010, 10011, 10011, 10101, ... a(n) = m is the smallest solution to m + bitcount(m) = n or n-1.  So a(n) = smaller nonzero of A228086(n) and A228086(n-1) (for n>=2). - Kevin Ryde, Jul 05 2020 LINKS Kevin Ryde, Pari/GP code and explanation, quantity "b(n)". FORMULA a(n) + bitcount(a(n)) + A334820(n) = n for n>=0. MAPLE s:= proc(n) option remember; `if`(n=0, [0, 0][], (l->      [l[], map(x-> x+2^(n-1), l[n..-1])[]][])([s(n-1)]))     end: s(7);  # gives 136 = A005126(7) terms;  # Alois P. Heinz, Jul 04 2020 PROG (PARI) a(n) = { if(n, my(k=logint(n, 2)); n-=k+1;   while(k>=0, if(!bittest(n, k), n++; if(bittest(n, k), return(n-1))); k--));   n; }  \\ Kevin Ryde, Jul 05 2020 CROSSREFS Cf. A005126, A334820. Sequence in context: A330332 A023816 A159237 * A227065 A010761 A320840 Adjacent sequences:  A335596 A335597 A335598 * A335600 A335601 A335602 KEYWORD nonn AUTHOR Richard Aime Blavy, Jun 15 2020 STATUS approved

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

Last modified April 13 03:43 EDT 2021. Contains 342934 sequences. (Running on oeis4.)