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.

Original entry on oeis.org

3, 6, 15, 28, 105, 351, 496, 1830, 7140, 30876, 129795, 508536, 2029105, 8260080, 32817151, 33550336, 133179360, 533811475, 2139135936, 8564460003, 34292793216, 137220150385, 549219598080, 2197036652910, 8791800675840, 35164716131980, 140703139101696, 562926884985640
Offset: 1

Views

Author

Alex Ratushnyak, Jun 16 2013

Keywords

Comments

The binary representation of the triangular number t (least significant bits of a(n)) is allowed to have leading zeros.
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, ...

Examples

			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.
		

Crossrefs

Programs

  • C
    #include 
    #include 
    typedef unsigned long long U64;
    U64 isTriangular(U64 a) {  // ! Must be a < (1<<63)
        U64 s = sqrt(a*2);
        return (s*(s+1) == a*2);
    }
    int main() {
      U64 i, j, n, tn, t, T, prev=0;
      for (n = tn = 3; tn > prev; prev = tn, tn += n, ++n) {
        for (i = 64, j = tn; j < (1ULL<<63); j += j)
          --i;  // binary length of tn
        j = i >> 1;  //  TOt or Tt, binary length of t is j
        t = tn & ((1ULL<> (j+(i&1));
        if (isTriangular(t) && isTriangular(T))
            printf("%20llu %10llu %10llu\n", tn, T, t);
      }
      return 0;
    }
  • Maple
    A000217 := proc(n)
        n*(n+1) /2 ;
    end proc:
    isA000217 := proc(n)
        local t1;
        t1:=floor(sqrt(2*n));
        if n = t1*(t1+1)/2 then
            true
        else
            false;
        end if;
    end proc:
    for n from 2 do
        tmain := A000217(n) ;
        dgs := convert(tmain,base,2) ;
        ndgs := floor(nops(dgs)/2) ;
        tlo := [op(1..ndgs,dgs)] ;
        if type(nops(dgs),'even') then
            thi := [op(ndgs+1..2*ndgs,dgs)] ;
        else
            thi := [op(ndgs+2..2*ndgs+1,dgs)] ;
        end if;
        tlo := add(op(i,tlo)*2^(i-1),i=1..nops(tlo)) ;
        if isA000217(tlo) then
            thi := add(op(i,thi)*2^(i-1),i=1..nops(thi)) ;
            if isA000217(thi) then
                printf("%d,\n",tmain) ;
            end if;
        end if;
    end do: # R. J. Mathar, Jun 18 2013