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!)
A228086 a(n) is the least k which satisfies n = k + bitcount(k), or 0 if no such k exists. Here bitcount(k) (or wt(k), A000120) gives the number of 1's in binary representation of nonnegative integer k. 10
0, 0, 1, 2, 0, 3, 0, 5, 6, 8, 7, 9, 10, 0, 11, 0, 13, 14, 0, 15, 18, 0, 19, 0, 21, 22, 24, 23, 25, 26, 0, 27, 0, 29, 30, 33, 31, 0, 35, 0, 37, 38, 40, 39, 41, 42, 0, 43, 0, 45, 46, 0, 47, 50, 0, 51, 0, 53, 54, 56, 55, 57, 58, 0, 59, 64, 61, 62, 66, 63, 67, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
A083058(n)+1 gives a lower bound for nonzero terms, n-1 an upper bound.
LINKS
MATHEMATICA
a[n_] := Module[{k}, For[k = n - Floor[Log[2, n]] - 1, k < n, k++, If[n == k + DigitCount[k, 2, 1], Return[k]]]; 0];
a /@ Range[0, 1000]; (* Jean-François Alcover, Nov 28 2020 *)
PROG
(Scheme) (define (A228086 n) (if (zero? n) n (let loop ((k (+ (A083058 n) 1))) (cond ((> k n) 0) ((= n (A092391 k)) k) (else (loop (+ 1 k)))))))
CROSSREFS
Cf. A228087, A228085, A335599. A010061 gives the positions of zeros after a(0). The union of A010061 and A228088 gives the positions where a(n) = A228087(n).
Cf. also A213723, A227643.
Sequence in context: A138325 A258323 A117175 * A090482 A082857 A208092
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 09 2013
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 April 23 16:40 EDT 2024. Contains 371916 sequences. (Running on oeis4.)