OFFSET
0,1
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
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Mar 29 2003
STATUS
approved