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.

A220698 Indices of triangular numbers generated in A224218.

This page as a plain text file.
%I A220698 #24 Aug 07 2023 07:49:08
%S A220698 1,6,6,14,14,14,14,43,43,36,57,36,52,43,49,43,89,52,89,52,121,49,52,
%T A220698 57,70,89,249,89,89,89,70,166,166,103,89,121,103,103,121,89,103,241,
%U A220698 158,158,91,91,91,91,241,166,166,103,121,103,103,121,103,121,225,225,497,216,334
%N A220698 Indices of triangular numbers generated in A224218.
%C A220698 Indices of triangular numbers in A220689. That is, S = triangular(i) XOR triangular(i+1); increment i; if S is a triangular number then index of S is appended to a(n). Initially i=0. XOR is the binary logical exclusive-or operator.
%F A220698 a(n) = i where A000217(i) = A220689(n).
%p A220698 A220698 := proc(n)
%p A220698     A127648(A220689(n)-1) ;
%p A220698 end proc: # _R. J. Mathar_, Apr 23 2013
%t A220698 nmax = 100;
%t A220698 pmax = 2 nmax^2; (* increase coeff 2 if A224218 is too short *)
%t A220698 A224218 = Join[{0}, Flatten[Position[Partition[Accumulate[Range[pmax]], 2, 1], _?(OddQ[Sqrt[1 + 8 BitXor[#[[1]], #[[2]]]]]&), {1}, Heads -> False]]];
%t A220698 a[n_] := Module[{i, t}, i = A224218[[n]]; t = BitXor[PolygonalNumber[i], PolygonalNumber[i + 1]]; (Sqrt[8 t + 1] - 1)/2];
%t A220698 Table[a[n], {n, 1, nmax}] (* _Jean-François Alcover_, Aug 07 2023, after _Harvey P. Dale_ in A224218 *)
%o A220698 (Python)
%o A220698 def rootTriangular(a):
%o A220698     sr = 1<<33
%o A220698     while a < sr*(sr+1)//2:
%o A220698       sr>>=1
%o A220698     b = sr>>1
%o A220698     while b:
%o A220698         s = sr+b
%o A220698         if a >= s*(s+1)//2:
%o A220698           sr = s
%o A220698         b>>=1
%o A220698     return sr
%o A220698 for i in range(1<<12):
%o A220698         s = (i*(i+1)//2) ^ ((i+1)*(i+2)//2)
%o A220698         t = rootTriangular(s)
%o A220698         if s == t*(t+1)//2:
%o A220698             print(str(t), end=',')
%Y A220698 Cf. A000217, A224218, A220689.
%K A220698 nonn
%O A220698 1,2
%A A220698 _Alex Ratushnyak_, Apr 13 2013