login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Triangular numbers generated in A224218. That is, the triangular numbers generated by the operation triangular(i) XOR triangular(i+1) along increasing i.
3

%I #33 Aug 07 2023 07:48:21

%S 1,21,21,105,105,105,105,946,946,666,1653,666,1378,946,1225,946,4005,

%T 1378,4005,1378,7381,1225,1378,1653,2485,4005,31125,4005,4005,4005,

%U 2485,13861,13861,5356,4005,7381,5356,5356,7381,4005,5356,29161,12561,12561,4186,4186,4186,4186

%N Triangular numbers generated in A224218. That is, the triangular numbers generated by the operation triangular(i) XOR triangular(i+1) along increasing i.

%F a(n) = A000217(A224218(n)) XOR A000217(A224218(n)+1).

%p read("transforms") ;

%p A220689 := proc(n)

%p i := A224218(n) ;

%p XORnos(A000217(i),A000217(i+1)) ;

%p end proc: # _R. J. Mathar_, Apr 23 2013

%t nmax = 100;

%t pmax = 2 nmax^2; (* increase coeff 2 if A224218 is too short *)

%t A224218 = Join[{0}, Flatten[Position[Partition[Accumulate[Range[pmax]], 2, 1], _?(OddQ[Sqrt[1 + 8 BitXor[#[[1]], #[[2]]]]]&), {1}, Heads -> False]]];

%t a[n_] := Module[{i}, i = A224218[[n]]; BitXor[PolygonalNumber[i], PolygonalNumber[i+1]]];

%t Table[a[n], {n, 1, nmax}] (* _Jean-François Alcover_, Aug 07 2023, after _Harvey P. Dale_ in A224218 *)

%o (Python)

%o def rootTriangular(a):

%o sr = 1<<33

%o while a < sr*(sr+1)//2:

%o sr>>=1

%o b = sr>>1

%o while b:

%o s = sr+b

%o if a >= s*(s+1)//2:

%o sr = s

%o b>>=1

%o return sr

%o for i in range(1<<12):

%o s = (i*(i+1)//2) ^ ((i+1)*(i+2)//2)

%o t = rootTriangular(s)

%o if s == t*(t+1)//2:

%o print(str(s), end=',')

%Y Cf. A000217, A224218, A224511.

%K nonn

%O 1,2

%A _Alex Ratushnyak_, Apr 13 2013