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.

Showing 1-1 of 1 results.

A231354 Least k such that n - triangular(k) is a square, or -1 if no such k exists.

Original entry on oeis.org

0, 0, 1, 2, 0, 1, 3, 2, -1, 0, 1, 4, 2, -1, 4, 3, 0, 1, -1, 2, -1, 6, 3, -1, 5, 0, 1, -1, 2, 7, 6, 3, 7, -1, -1, 4, 0, 1, -1, 2, 5, -1, 3, -1, 7, 8, 4, -1, -1, 0, 1, 5, 2, 7, 9, 3, 10, 6, -1, 4, -1, 8, -1, -1, 0, 1, 11, 2, -1, -1, 3, 10, 8, -1, 4, 11, -1, 7, 12, 5, 10, 0
Offset: 0

Views

Author

Alex Ratushnyak, Nov 08 2013

Keywords

Comments

Indices of -1's: A014134.
Indices of 0's: A000290.
Indices of 1's: A002522.

Crossrefs

Programs

  • Python
    import math
    for n in range(333):
      for k in range(1000000):
        t = n - k*(k+1)/2
        if t<0:
          print('-1', end=', ')
          break
        r = int(math.sqrt(t))
        if r*r==t:
          print(str(k), end=', ')
          break
Showing 1-1 of 1 results.