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.

A226499 Triangular numbers representable as m * triangular(m).

Original entry on oeis.org

0, 1, 6, 4851
Offset: 1

Views

Author

Alex Ratushnyak, Jun 09 2013

Keywords

Examples

			6 = 2 * triangular(2).
4851 = 21 * triangular(21).
		

Crossrefs

Cf. A000217.

Programs

  • Mathematica
    TriangularQ[n_] := IntegerQ[Sqrt[1 + 8*n]]; s = Select[Range[0, 10000], TriangularQ[#^2 (# + 1)/2] &]; s^2 (s + 1)/2 (* T. D. Noe, Jun 12 2013 *)
  • Python
    def isTriangular(a):
        sr = 1 << (int.bit_length(int(a)) >> 1)
        a += a
        while a < sr*(sr+1):  sr>>=1
        b = sr>>1
        while b:
          s = sr+b
          if a >= s*(s+1):  sr = s
          b>>=1
        return (a==sr*(sr+1))
    for n in range(10000):
      product = n*n*(n+1)//2
      if isTriangular(product):  print(product, end=',')