A151774 Characteristic function of numbers with binary weight 2 (A018900).
0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 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
Offset: 0
Links
Programs
-
Mathematica
w[n_] := IntegerDigits[n, 2] // Total; a[n_] := Boole[w[n] == 2]; a /@ Range[0, 105] (* Jean-François Alcover, Mar 31 2021 *)
-
PARI
a(n)=hammingweight(n)==2 \\ Charles R Greathouse IV, Sep 26 2015
Formula
Let Theta = Sum_{k >= 0} x^(2^k). G.f. is (x + Theta^2 - Theta)/2 (cf. A151758).
Comments