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.

A220698 Indices of triangular numbers generated in A224218.

Original entry on oeis.org

1, 6, 6, 14, 14, 14, 14, 43, 43, 36, 57, 36, 52, 43, 49, 43, 89, 52, 89, 52, 121, 49, 52, 57, 70, 89, 249, 89, 89, 89, 70, 166, 166, 103, 89, 121, 103, 103, 121, 89, 103, 241, 158, 158, 91, 91, 91, 91, 241, 166, 166, 103, 121, 103, 103, 121, 103, 121, 225, 225, 497, 216, 334
Offset: 1

Views

Author

Alex Ratushnyak, Apr 13 2013

Keywords

Comments

Indices of triangular numbers in A220689. That is, S = triangular(i) XOR triangular(i+1); increment i; if S is a triangular number then index of S is appended to a(n). Initially i=0. XOR is the binary logical exclusive-or operator.

Crossrefs

Programs

  • Maple
    A220698 := proc(n)
        A127648(A220689(n)-1) ;
    end proc: # R. J. Mathar, Apr 23 2013
  • Mathematica
    nmax = 100;
    pmax = 2 nmax^2; (* increase coeff 2 if A224218 is too short *)
    A224218 = Join[{0}, Flatten[Position[Partition[Accumulate[Range[pmax]], 2, 1], _?(OddQ[Sqrt[1 + 8 BitXor[#[[1]], #[[2]]]]]&), {1}, Heads -> False]]];
    a[n_] := Module[{i, t}, i = A224218[[n]]; t = BitXor[PolygonalNumber[i], PolygonalNumber[i + 1]]; (Sqrt[8 t + 1] - 1)/2];
    Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Aug 07 2023, after Harvey P. Dale in A224218 *)
  • 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(t), end=',')

Formula

a(n) = i where A000217(i) = A220689(n).