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.

A224218 Indices of XOR-positive triangular numbers. That is, numbers n such that triangular(n) XOR triangular(n+1) is a triangular number, where XOR is the bitwise logical XOR operator.

This page as a plain text file.
%I A224218 #32 May 04 2021 09:02:08
%S A224218 0,12,18,24,40,86,102,177,333,357,628,665,669,689,840,845,860,861,
%T A224218 1124,1185,1196,1206,1377,1418,1706,1890,1906,1956,2138,2204,2388,
%U A224218 2524,2588,2843,2970,2994,3035,3107,3154,3234,3299,3606,3824,3854,4005,4021,4169,4185,4568,4580
%N A224218 Indices of XOR-positive triangular numbers. That is, numbers n such that triangular(n) XOR triangular(n+1) is a triangular number, where XOR is the bitwise logical XOR operator.
%C A224218 Generated triangular numbers: A220689(n) = A000217(a(n)) XOR A000217(a(n)+1).
%C A224218 Indices of triangular numbers in A220689: A220698.
%C A224218 Terms of A220698 that appear in this sequence: A220752.
%H A224218 Harvey P. Dale, <a href="/A224218/b224218.txt">Table of n, a(n) for n = 1..1000</a>
%e A224218 Triangular(18) XOR triangular(19) = 171 XOR 190 = 21, because 21 is a triangular number, 18 is in the sequence.
%p A224218 read("transforms") ;
%p A224218 isA000217 := proc(n)
%p A224218     local t1;
%p A224218     t1:=floor(sqrt(2*n));
%p A224218     if n = t1*(t1+1)/2 then
%p A224218         return true
%p A224218     else
%p A224218         return false;
%p A224218     end if;
%p A224218 end proc:
%p A224218 isA224218 := proc(n)
%p A224218     XORnos(A000217(n),A000217(n+1)) ;
%p A224218     isA000217(%) ;
%p A224218 end proc:
%p A224218 A224218 := proc(n)
%p A224218     option remember;
%p A224218     if n = 1 then
%p A224218         0;
%p A224218     else
%p A224218         for a from procname(n-1)+1 do
%p A224218             if isA224218(a) then
%p A224218                 return a;
%p A224218             end if;
%p A224218         end do:
%p A224218     end if;
%p A224218 end proc: # _R. J. Mathar_, Apr 23 2013
%t A224218 Join[{0},Flatten[Position[Partition[Accumulate[Range[5000]],2,1],_?(OddQ[ Sqrt[1+8BitXor[#[[1]],#[[2]]]]]&),{1},Heads->False]]] (* _Harvey P. Dale_, Dec 05 2014 *)
%o A224218 (Python)
%o A224218 def rootTriangular(a):
%o A224218     sr = 1<<33
%o A224218     while a < sr*(sr+1)//2:
%o A224218       sr>>=1
%o A224218     b = sr>>1
%o A224218     while b:
%o A224218         s = sr+b
%o A224218         if a >= s*(s+1)//2:
%o A224218           sr = s
%o A224218         b>>=1
%o A224218     return sr
%o A224218 for i in range(1<<12):
%o A224218         s = (i*(i+1)//2) ^ ((i+1)*(i+2)//2)
%o A224218         t = rootTriangular(s);
%o A224218         if s == t*(t+1)//2:
%o A224218             print(str(i), end=',')
%Y A224218 Cf. A000217, A220689, A220698, A220752, A221643, A220518.
%K A224218 nonn,base
%O A224218 1,2
%A A224218 _Alex Ratushnyak_, Apr 01 2013