login
a(n) = 1 if n is of the form 2^i - 2^j with i >= j, and 0 otherwise.
4

%I #6 Jan 07 2021 08:37:36

%S 1,1,1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,

%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1

%N a(n) = 1 if n is of the form 2^i - 2^j with i >= j, and 0 otherwise.

%H Antti Karttunen, <a href="/A340375/b340375.txt">Table of n, a(n) for n = 0..65537</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(0) = 1; for n > 1, a(n) = A209229(1+A000265(n)).

%o (PARI)

%o A000265(n) = (n>>valuation(n,2));

%o A209229(n) = (n && !bitand(n,n-1));

%o A340375(n) = if(!n,1,A209229(1+A000265(n)));

%o (PARI) A340375(n) = if(n<5, 1, n>>=valuation(n, 2); n++; n>>valuation(n, 2)==1); \\ From standalone function "is" given in A023758

%Y Characteristic function of A023758.

%Y Cf. A000265, A209229.

%K nonn

%O 0

%A _Antti Karttunen_, Jan 06 2021