A193232 Bitwise XOR of first n triangular numbers.
0, 1, 2, 4, 14, 1, 20, 8, 44, 1, 54, 116, 58, 97, 8, 112, 248, 97, 202, 116, 166, 65, 188, 424, 132, 449, 158, 484, 114, 449, 16, 480, 1008, 449, 914, 484, 894, 449, 804, 40, 796, 65, 966, 116, 938, 1953, 920, 2032, 872, 1953, 858, 1652, 790, 1665, 844, 1352
Offset: 0
Keywords
Links
- John Tyler Rascoe, Table of n, a(n) for n = 0..10000
Programs
-
Maple
a:= proc(n) option remember; `if`(n=0, 0, Bits[Xor](a(n-1), n*(n+1)/2)) end: seq(a(n), n=0..55); # Alois P. Heinz, Feb 19 2023
-
Mathematica
Module[{nn=60,trs},trs=Accumulate[Range[nn]];Table[BitXor@@Take[trs,n],{n,0,nn}]] (* Harvey P. Dale, Dec 15 2017 *)
-
PARI
al(n) = local(m); vector(n,k,m=bitxor(m,k*(k+1)\2))
-
Python
from operator import xor from functools import reduce def A193232(n): return reduce(xor, (x*(x+1) for x in range(n+1)))//2 # Chai Wah Wu, Dec 16 2021