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.

A226736 Triangular numbers such that the binary representation is of the form either Tbt or Tt, where T and t are binary representations of triangular numbers with equal binary length, and b is a binary digit: b = 1 or 0.

This page as a plain text file.
%I A226736 #13 Jan 03 2016 04:38:48
%S A226736 3,6,15,28,105,351,496,1830,7140,30876,129795,508536,2029105,8260080,
%T A226736 32817151,33550336,133179360,533811475,2139135936,8564460003,
%U A226736 34292793216,137220150385,549219598080,2197036652910,8791800675840,35164716131980,140703139101696,562926884985640
%N A226736 Triangular numbers such that the binary representation is of the form either Tbt or Tt, where T and t are binary representations of triangular numbers with equal binary length, and b is a binary digit: b = 1 or 0.
%C A226736 The binary representation of the triangular number t (least significant bits of a(n)) is allowed to have leading zeros.
%C A226736 The sequence of indices of a(n) begins: 2, 3, 5, 7, 14, 26, 31, 60, 119, 248, 509, 1008, 2014, 4064, 8101, 8191, 16320, 32674, 65408, 130877, 261888, 523870, 1048064, 2096204, 4193280, 8386264, 16775168, 33553744, ...
%e A226736 105 = (1101001)_2 = (110)_2//(1)_2//(001)_2 is in the sequence, where 105, (110)_2 = 6 and (001)_2=1 are each triangular numbers.
%p A226736 A000217 := proc(n)
%p A226736     n*(n+1) /2 ;
%p A226736 end proc:
%p A226736 isA000217 := proc(n)
%p A226736     local t1;
%p A226736     t1:=floor(sqrt(2*n));
%p A226736     if n = t1*(t1+1)/2 then
%p A226736         true
%p A226736     else
%p A226736         false;
%p A226736     end if;
%p A226736 end proc:
%p A226736 for n from 2 do
%p A226736     tmain := A000217(n) ;
%p A226736     dgs := convert(tmain,base,2) ;
%p A226736     ndgs := floor(nops(dgs)/2) ;
%p A226736     tlo := [op(1..ndgs,dgs)] ;
%p A226736     if type(nops(dgs),'even') then
%p A226736         thi := [op(ndgs+1..2*ndgs,dgs)] ;
%p A226736     else
%p A226736         thi := [op(ndgs+2..2*ndgs+1,dgs)] ;
%p A226736     end if;
%p A226736     tlo := add(op(i,tlo)*2^(i-1),i=1..nops(tlo)) ;
%p A226736     if isA000217(tlo) then
%p A226736         thi := add(op(i,thi)*2^(i-1),i=1..nops(thi)) ;
%p A226736         if isA000217(thi) then
%p A226736             printf("%d,\n",tmain) ;
%p A226736         end if;
%p A226736     end if;
%p A226736 end do: # _R. J. Mathar_, Jun 18 2013
%o A226736 (C)
%o A226736 #include <stdio.h>
%o A226736 #include <math.h>
%o A226736 typedef unsigned long long U64;
%o A226736 U64 isTriangular(U64 a) {  // ! Must be a < (1<<63)
%o A226736     U64 s = sqrt(a*2);
%o A226736     return (s*(s+1) == a*2);
%o A226736 }
%o A226736 int main() {
%o A226736   U64 i, j, n, tn, t, T, prev=0;
%o A226736   for (n = tn = 3; tn > prev; prev = tn, tn += n, ++n) {
%o A226736     for (i = 64, j = tn; j < (1ULL<<63); j += j)
%o A226736       --i;  // binary length of tn
%o A226736     j = i >> 1;  //  TOt or Tt, binary length of t is j
%o A226736     t = tn & ((1ULL<<j)-1);
%o A226736     T = tn >> (j+(i&1));
%o A226736     if (isTriangular(t) && isTriangular(T))
%o A226736         printf("%20llu %10llu %10llu\n", tn, T, t);
%o A226736   }
%o A226736   return 0;
%o A226736 }
%Y A226736 Cf. A000217, A070939, A226836.
%K A226736 nonn,base,less
%O A226736 1,1
%A A226736 _Alex Ratushnyak_, Jun 16 2013