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.

A224218 Indices of XOR-positive triangular numbers. That is, numbers n such that triangular(n) XOR triangular(n+1) is a triangular number, where XOR is the bitwise logical XOR operator.

Original entry on oeis.org

0, 12, 18, 24, 40, 86, 102, 177, 333, 357, 628, 665, 669, 689, 840, 845, 860, 861, 1124, 1185, 1196, 1206, 1377, 1418, 1706, 1890, 1906, 1956, 2138, 2204, 2388, 2524, 2588, 2843, 2970, 2994, 3035, 3107, 3154, 3234, 3299, 3606, 3824, 3854, 4005, 4021, 4169, 4185, 4568, 4580
Offset: 1

Views

Author

Alex Ratushnyak, Apr 01 2013

Keywords

Comments

Generated triangular numbers: A220689(n) = A000217(a(n)) XOR A000217(a(n)+1).
Indices of triangular numbers in A220689: A220698.
Terms of A220698 that appear in this sequence: A220752.

Examples

			Triangular(18) XOR triangular(19) = 171 XOR 190 = 21, because 21 is a triangular number, 18 is in the sequence.
		

Crossrefs

Programs

  • Maple
    read("transforms") ;
    isA000217 := proc(n)
        local t1;
        t1:=floor(sqrt(2*n));
        if n = t1*(t1+1)/2 then
            return true
        else
            return false;
        end if;
    end proc:
    isA224218 := proc(n)
        XORnos(A000217(n),A000217(n+1)) ;
        isA000217(%) ;
    end proc:
    A224218 := proc(n)
        option remember;
        if n = 1 then
            0;
        else
            for a from procname(n-1)+1 do
                if isA224218(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Apr 23 2013
  • Mathematica
    Join[{0},Flatten[Position[Partition[Accumulate[Range[5000]],2,1],?(OddQ[ Sqrt[1+8BitXor[#[[1]],#[[2]]]]]&),{1},Heads->False]]] (* _Harvey P. Dale, Dec 05 2014 *)
  • Python
    def rootTriangular(a):
        sr = 1<<33
        while a < sr*(sr+1)//2:
          sr>>=1
        b = sr>>1
        while b:
            s = sr+b
            if a >= s*(s+1)//2:
              sr = s
            b>>=1
        return sr
    for i in range(1<<12):
            s = (i*(i+1)//2) ^ ((i+1)*(i+2)//2)
            t = rootTriangular(s);
            if s == t*(t+1)//2:
                print(str(i), end=',')