|
|
A298818
|
|
a(n) is the binary XOR of all n-bit triangular numbers.
|
|
0
|
|
|
1, 3, 6, 5, 9, 62, 70, 204, 348, 586, 1770, 3582, 6974, 9046, 22486, 12225, 54977, 97140, 201076, 34728, 347048, 1031920, 2250480, 10857648, 24157360, 40826080, 112612576, 21772545, 130349313, 1060428174, 1126848910, 1106260993, 2017932289, 3773334644, 13412500596, 6378289192, 37614057512
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
XOR is the binary exclusive-or operator.
Note { a(20), a(21) } = { 34728, 347048 }. First 3 and last digits are the same.
Also { a(27), a(31) } = { 112612576, 1126848910 }. First 4 decimal digits are the same.
|
|
LINKS
|
|
|
EXAMPLE
|
There are two 4-bit triangular numbers, namely 10 and 15; a(4) = (10 XOR 15) = 5.
|
|
PROG
|
(Python)
i = n = x = L = 1
while L < 47:
i+=1
nextn = i*(i+1)/2
if (nextn ^ n) > n:
print str(x)+', ',
x = 0
prevL = L
L = len(bin(nextn))-2
for j in range(prevL, L-1): print '0, ',
n = nextn
x ^= n
(PARI) a(n) = {my(x = 0); for (k=2^(n-1), 2^n-1, if (ispolygonal(k, 3), x = bitxor(x, k)); ); x; } \\ Michel Marcus, Feb 13 2018
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|