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!)
 A014081 a(n) is the number of occurrences of '11' in binary expansion of n. 39
 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 1, 2, 1, 1, 1, 2, 2, 2, 3, 4, 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 1, 2, 3, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 4, 5, 0, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 1, 2, 3, 0, 0, 0, 1, 0, 0, 1, 2, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,8 COMMENTS a(n) takes the value k for the first time at n = 2^(k+1)-1. Cf. A000225. - Robert G. Wilson v, Apr 02 2009 a(n) = A213629(n,3) for n > 2. - Reinhard Zumkeller, Jun 17 2012 LINKS Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 Helmut Prodinger, Generalizing the sum of digits function, SIAM J. Algebraic Discrete Methods 3 (1982), no. 1, 35--42. MR0644955 (83f:10009).. [See B_2(11,n) on p. 35. - N. J. A. Sloane, Apr 06 2014] Michel Rigo and Manon Stipulanti, Revisiting regular sequences in light of rational base numeration systems, arXiv:2103.16966 [cs.FL], 2021. Mentions this sequence. Ralf Stephan, Some divide-and-conquer sequences ... Ralf Stephan, Table of generating functions Eric Weisstein's World of Mathematics, Digit Block Eric Weisstein's World of Mathematics, Rudin-Shapiro Sequence FORMULA a(4n) = a(4n+1) = a(n), a(4n+2) = a(2n+1), a(4n+3) = a(2n+1) + 1. - Ralf Stephan, Aug 21 2003 G.f.: 1/(1-x) * Sum_{k>=0} t^3/((1+t)*(1+t^2)), where t = x^(2^k). - Ralf Stephan, Sep 10 2003 a(n) = A000120(n) - A069010(n). - Ralf Stephan, Sep 10 2003 EXAMPLE The binary expansion of 15 is 1111, which contains three occurrences of 11, so a(15)=3. MAPLE # To count occurrences of 11..1 (k times) in binary expansion of v: cn := proc(v, k) local n, s, nn, i, j, som, kk; som := 0; kk := convert(cat(seq(1, j = 1 .. k)), string); n := convert(v, binary); s := convert(n, string); nn := length(s); for i to nn - k + 1 do if substring(s, i .. i + k - 1) = kk then som := som + 1 fi od; som; end; # This program no longer worked. Corrected by N. J. A. Sloane, Apr 06 2014. [seq(cn(n, 2), n=0..300)]; # Alternative: A014081 := proc(n) option remember;   if n mod 4 <= 1 then procname(floor(n/4)) elif n mod 4 = 2 then procname(n/2) else 1 + procname((n-1)/2) fi end proc: A014081(0):= 0: map(A014081, [\$0..1000]); # Robert Israel, Sep 04 2015 MATHEMATICA f[n_] := Count[ Partition[ IntegerDigits[n, 2], 2, 1], {1, 1}]; Table[ f@n, {n, 0, 104}] (* Robert G. Wilson v, Apr 02 2009 *) PROG (Haskell) import Data.Bits ((.&.)) a014081 n = a000120 (n .&. div n 2)  -- Reinhard Zumkeller, Jan 23 2012 (PARI) A014081(n)=sum(i=0, #binary(n)-2, bitand(n>>i, 3)==3)  \\ M. F. Hasler, Jun 06 2012 (PARI) a(n) = hammingweight(bitand(n, n>>1)) ; vector(105, i, a(i-1))  \\ Gheorghe Coserea, Aug 30 2015 (Python) def a(n): return sum([((n>>i)&3==3) for i in range(len(bin(n)[2:]) - 1)]) # Indranil Ghosh, Jun 03 2017 CROSSREFS Cf. A014082, A033264, A037800, A056973, A000225, A213629, A000120, A069010. First differences give A245194. A245195 gives 2^a(n). Sequence in context: A307247 A147693 A070936 * A091890 A029431 A091492 Adjacent sequences:  A014078 A014079 A014080 * A014082 A014083 A014084 KEYWORD nonn,easy AUTHOR 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 20 06:59 EDT 2021. Contains 343125 sequences. (Running on oeis4.)