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.

A220518 Numbers n such that A193232(n) is a triangular number.

Original entry on oeis.org

0, 1, 5, 9, 45, 49, 101, 153, 1569, 7163, 7171, 8162, 18974, 18976, 24467, 33490, 60290, 63046, 359539, 551494, 1769418, 2813691, 4140392, 4649729, 6675935, 9653486, 59131393, 158169499, 243345386, 588183781, 1315697727, 1387290631, 1522472645, 1879098546
Offset: 1

Views

Author

Alex Ratushnyak, Mar 27 2013

Keywords

Comments

Numbers k such that bitwise XOR of first k triangular numbers is a triangular number.

Crossrefs

Cf. A193232.
Cf. A145827 (bitwise XOR of first k squares is a square).

Programs

  • C
    #include 
    typedef unsigned long long U64;
    U64 rootTriangular(U64 a) {
        U64 sr = 1L<<32, s, b;
        if (a < (sr/2)*(sr+1)) {
          sr>>=1;
          while (a < sr*(sr+1)/2)  sr>>=1;
        }
        for (b = sr>>1; b; b>>=1) {
            s = sr+b;
            if (a >= s*(s+1)/2)  sr = s;
        }
        return sr;
    }
    int main() {
      U64 a=0, i, t;
      for (i=0; i < 1L<<32; ++i) {
          a ^= i*(i+1)/2;
          t = rootTriangular(a);
          if (a == t*(t+1)/2)  printf("%llu\n", i);
      }
      return 0;
    }