cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A014082 Number of occurrences of '111' in binary expansion of n.

This page as a plain text file.
%I A014082 #50 Feb 16 2025 08:32:32
%S A014082 0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,0,1,1,2,3,0,0,
%T A014082 0,0,0,0,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,1,1,1,1,1,2,2,3,4,0,0,0,0,
%U A014082 0,0,0,1,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,1,0,0,0,0,1,1,2,3,0,0,0,0,0,0,0,1,0
%N A014082 Number of occurrences of '111' in binary expansion of n.
%C A014082 a(n) = A213629(n,7) for n > 6. - _Reinhard Zumkeller_, Jun 17 2012
%H A014082 Reinhard Zumkeller, <a href="/A014082/b014082.txt">Table of n, a(n) for n = 0..10000</a>
%H A014082 Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>
%H A014082 Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>
%H A014082 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DigitBlock.html">Digit Block</a>
%H A014082 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A014082 a(2n) = a(n), a(2n+1) = a(n) + [n congruent to 3 mod 4]. - _Ralf Stephan_, Aug 21 2003
%F A014082 G.f.: 1/(1-x) * Sum_{k>=0} t^7(1-t)/(1-t^8), where t=x^2^k. - _Ralf Stephan_, Sep 08 2003
%p A014082 See A014081.
%p A014082 f:= proc(n) option remember;
%p A014082   if n::even then procname(n/2)
%p A014082   elif n mod 8 = 7 then 1 + procname((n-1)/2)
%p A014082   else procname((n-1)/2)
%p A014082 fi
%p A014082 end proc:
%p A014082 f(0):= 0:
%p A014082 map(f, [$0..1000]); # _Robert Israel_, Sep 11 2015
%t A014082 f[n_] := Count[ Partition[ IntegerDigits[n, 2], 3, 1], {1, 1, 1}]; Table[f@n, {n, 0, 104}] (* _Robert G. Wilson v_, Apr 02 2009 *)
%t A014082 a[0] = a[1] = 0; a[n_] := a[n] = If[EvenQ[n], a[n/2], a[(n - 1)/2] + Boole[Mod[(n - 1)/2, 4] == 3]]; Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Oct 22 2012, after _Ralf Stephan_ *)
%t A014082 Table[SequenceCount[IntegerDigits[n,2],{1,1,1},Overlaps->True],{n,0,110}] (* _Harvey P. Dale_, Mar 05 2023 *)
%o A014082 (Haskell)
%o A014082 import Data.List (tails, isPrefixOf)
%o A014082 a014082 = sum . map (fromEnum . ([1,1,1] `isPrefixOf`)) .
%o A014082                     tails . a030308_row
%o A014082 -- _Reinhard Zumkeller_, Jun 17 2012
%o A014082 (PARI) a(n) = hammingweight(bitand(n, bitand(n>>1, n>>2))); \\ _Gheorghe Coserea_, Aug 30 2015
%Y A014082 Cf. A014081, A033264, A056974, A056975, A056976, A056977, A056978, A056979, A056980, A213629, A239906, A239907.
%K A014082 nonn,easy,base
%O A014082 0,16
%A A014082 _Simon Plouffe_