A213540 Numbers k such that k AND k*2 = 2, where AND is the bitwise AND operator.
3, 11, 19, 35, 43, 67, 75, 83, 131, 139, 147, 163, 171, 259, 267, 275, 291, 299, 323, 331, 339, 515, 523, 531, 547, 555, 579, 587, 595, 643, 651, 659, 675, 683, 1027, 1035, 1043, 1059, 1067, 1091, 1099, 1107, 1155, 1163, 1171, 1187, 1195, 1283, 1291, 1299, 1315
Offset: 1
Examples
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. 20 is not in the sequence, since 010100 AND 101000 = 000000.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
Maple
F:= combinat[fibonacci]: b:= proc(n) local j; if n=0 then 0 else for j from 2 while F(j+1)<=n do od; b(n-F(j))+2^(j-2) fi end: a:= n-> 8*b(n-1)+3: seq(a(n), n=1..60); # Alois P. Heinz, Jun 17 2012
-
Mathematica
Select[Range[1024], BitAnd[#, 2#] == 2 &] (* Alonso del Arte, Jun 18 2012 *)
-
PARI
is(n)=bitand(n,2*n)==2 \\ Charles R Greathouse IV, Jun 18 2012
-
Python
for n in range(1777): a = 2*n & n if a==2: print(n, end=',')
Formula
a(n) = A003714(n-1)*8 + 3.