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!)
A014082 Number of occurrences of '111' in binary expansion of n. 16
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,16
COMMENTS
a(n) = A213629(n,7) for n > 6. - Reinhard Zumkeller, Jun 17 2012
LINKS
Eric Weisstein's World of Mathematics, Digit Block
FORMULA
a(2n) = a(n), a(2n+1) = a(n) + [n congruent to 3 mod 4]. - Ralf Stephan, Aug 21 2003
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
MAPLE
See A014081.
f:= proc(n) option remember;
if n::even then procname(n/2)
elif n mod 8 = 7 then 1 + procname((n-1)/2)
else procname((n-1)/2)
fi
end proc:
f(0):= 0:
map(f, [$0..1000]); # Robert Israel, Sep 11 2015
MATHEMATICA
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 *)
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 *)
Table[SequenceCount[IntegerDigits[n, 2], {1, 1, 1}, Overlaps->True], {n, 0, 110}] (* Harvey P. Dale, Mar 05 2023 *)
PROG
(Haskell)
import Data.List (tails, isPrefixOf)
a014082 = sum . map (fromEnum . ([1, 1, 1] `isPrefixOf`)) .
tails . a030308_row
-- Reinhard Zumkeller, Jun 17 2012
(PARI) a(n) = hammingweight(bitand(n, bitand(n>>1, n>>2))); \\ Gheorghe Coserea, Aug 30 2015
CROSSREFS
Sequence in context: A086078 A353462 A323913 * A322583 A351439 A102354
KEYWORD
nonn,easy,base
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 | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 15:18 EDT 2024. Contains 371960 sequences. (Running on oeis4.)