login
A220518
Numbers n such that A193232(n) is a triangular number.
1
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,3
COMMENTS
Numbers k such that bitwise XOR of first k triangular numbers is a triangular number.
PROG
(C)
#include <stdio.h>
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;
}
CROSSREFS
Cf. A193232.
Cf. A145827 (bitwise XOR of first k squares is a square).
Sequence in context: A226065 A321718 A304127 * A145031 A121724 A149496
KEYWORD
base,nonn
AUTHOR
Alex Ratushnyak, Mar 27 2013
STATUS
approved