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!)
A213540 Numbers k such that k AND k*2 = 2, where AND is the bitwise AND operator. 3

%I #29 May 22 2021 04:30:21

%S 3,11,19,35,43,67,75,83,131,139,147,163,171,259,267,275,291,299,323,

%T 331,339,515,523,531,547,555,579,587,595,643,651,659,675,683,1027,

%U 1035,1043,1059,1067,1091,1099,1107,1155,1163,1171,1187,1195,1283,1291,1299,1315

%N Numbers k such that k AND k*2 = 2, where AND is the bitwise AND operator.

%H Charles R Greathouse IV, <a href="/A213540/b213540.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A003714(n-1)*8 + 3.

%e In binary, 19 is 10011, while 2 * 19 = 38 is of course 100110. Since 010011 AND 100110 = 000010 (in decimal, 2), 19 is in the sequence.

%e 20 is not in the sequence, since 010100 AND 101000 = 000000.

%p F:= combinat[fibonacci]:

%p b:= proc(n) local j;

%p if n=0 then 0

%p else for j from 2 while F(j+1)<=n do od;

%p b(n-F(j))+2^(j-2)

%p fi

%p end:

%p a:= n-> 8*b(n-1)+3:

%p seq(a(n), n=1..60); # _Alois P. Heinz_, Jun 17 2012

%t Select[Range[1024], BitAnd[#, 2#] == 2 &] (* _Alonso del Arte_, Jun 18 2012 *)

%o (Python)

%o for n in range(1777):

%o a = 2*n & n

%o if a==2:

%o print(n, end=',')

%o (PARI) is(n)=bitand(n,2*n)==2 \\ _Charles R Greathouse IV_, Jun 18 2012

%Y Cf. A213370, A004198, A003714.

%K nonn,base

%O 1,1

%A _Alex Ratushnyak_, Jun 14 2012

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 July 26 13:14 EDT 2024. Contains 374635 sequences. (Running on oeis4.)