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.

Original entry on oeis.org

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

Views

Author

Alex Ratushnyak, Jun 14 2012

Keywords

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.
		

Crossrefs

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.