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!)
A075897 1 if binary weight of n is 1 or 2, otherwise 0. 9
0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
FORMULA
a(n) = 1 if n is in A048645, 0 otherwise.
For n>0: a(n) = 0^floor(A000120(n)/3). - Reinhard Zumkeller, Apr 07 2003
MATHEMATICA
Table[If[MemberQ[{1, 2}, Total[IntegerDigits[n, 2]]], 1, 0], {n, 0, 120}] (* Harvey P. Dale, Jul 26 2017 *)
PROG
(PARI) a(n)=(hammingweight(n)+1)\2 == 1 \\ Charles R Greathouse IV, Jan 10 2022
(PARI) a(n)=(hammingweight(n)) <= 2 && n > 0 \\ David A. Corneth, Jan 11 2022
(Python)
def a(n): return int(bin(n).count('1') in [1, 2])
print([a(n) for n in range(105)]) # Michael S. Branicky, Jan 11 2022
CROSSREFS
Sequence in context: A167393 A275606 A106549 * A135947 A360123 A211487
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Mar 29 2003
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 18:16 EDT 2024. Contains 371916 sequences. (Running on oeis4.)