cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A213540 #29 May 22 2021 04:30:21
%S A213540 3,11,19,35,43,67,75,83,131,139,147,163,171,259,267,275,291,299,323,
%T A213540 331,339,515,523,531,547,555,579,587,595,643,651,659,675,683,1027,
%U A213540 1035,1043,1059,1067,1091,1099,1107,1155,1163,1171,1187,1195,1283,1291,1299,1315
%N A213540 Numbers k such that k AND k*2 = 2, where AND is the bitwise AND operator.
%H A213540 Charles R Greathouse IV, <a href="/A213540/b213540.txt">Table of n, a(n) for n = 1..10000</a>
%F A213540 a(n) = A003714(n-1)*8 + 3.
%e A213540 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 A213540 20 is not in the sequence, since 010100 AND 101000 = 000000.
%p A213540 F:= combinat[fibonacci]:
%p A213540 b:= proc(n) local j;
%p A213540       if n=0 then 0
%p A213540     else for j from 2 while F(j+1)<=n do od;
%p A213540          b(n-F(j))+2^(j-2)
%p A213540       fi
%p A213540     end:
%p A213540 a:= n-> 8*b(n-1)+3:
%p A213540 seq(a(n), n=1..60);  # _Alois P. Heinz_, Jun 17 2012
%t A213540 Select[Range[1024], BitAnd[#, 2#] == 2 &] (* _Alonso del Arte_, Jun 18 2012 *)
%o A213540 (Python)
%o A213540 for n in range(1777):
%o A213540     a = 2*n & n
%o A213540     if a==2:
%o A213540         print(n, end=',')
%o A213540 (PARI) is(n)=bitand(n,2*n)==2 \\ _Charles R Greathouse IV_, Jun 18 2012
%Y A213540 Cf. A213370, A004198, A003714.
%K A213540 nonn,base
%O A213540 1,1
%A A213540 _Alex Ratushnyak_, Jun 14 2012