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!)
A159481 Number of evil numbers <= n, see A001969. 8
1, 1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 9, 10, 10, 11, 11, 11, 12, 13, 13, 13, 14, 14, 15, 16, 16, 16, 17, 18, 18, 19, 19, 19, 20, 21, 21, 21, 22, 22, 23, 24, 24, 25, 25, 25, 26, 26, 27, 28, 28, 28, 29, 30, 30, 31, 31, 31, 32, 32, 33, 34, 34, 35, 35, 35, 36, 37, 37, 37 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
a(n) = n + 1 - A115384(n);
Limit_{n->oo} n/a(n) = 1/2.
LINKS
Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, Identities and periodic oscillations of divide-and-conquer recurrences splitting at half, arXiv:2210.10968 [cs.DS], 2022, p. 52.
FORMULA
a(n) = Sum_{k=0..n} A010059(k).
a(n) = floor(n/2) - (1 + (-1)^n)*(1 - (-1)^A000120(n))/4 + 1. - Vladimir Shevelev, May 27 2009
G.f.: (1/(1 - x)^2 + Product_{k>=1} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019
EXAMPLE
a(10) = #{0,11,101,110,1001,1010} = #{0,3,5,6,9,10} = 6.
MATHEMATICA
Accumulate[Table[If[EvenQ[DigitCount[n, 2, 1]], 1, 0], {n, 0, 80}]] (* Harvey P. Dale, Mar 19 2018 *)
PROG
(PARI) a(n)=n\2+(n%2&&hammingweight(n)%2) \\ Charles R Greathouse IV, Mar 22 2013
(Python)
def A159481(n): return (n+1>>1)+((n+1).bit_count()&1&n+1) # Chai Wah Wu, Mar 01 2023
CROSSREFS
Sequence in context: A092038 A269990 A324473 * A194206 A307482 A046699
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Apr 16 2009
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 28 11:12 EDT 2024. Contains 372043 sequences. (Running on oeis4.)