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.

A232179 Least k >= 0 such that n^2 + triangular(k) is a triangular number.

Original entry on oeis.org

0, 0, 3, 1, 15, 2, 0, 3, 63, 4, 8, 5, 11, 6, 20, 3, 255, 8, 1, 9, 3, 10, 38, 11, 59, 12, 45, 13, 8, 14, 2, 15, 1023, 16, 59, 0, 24, 18, 66, 19, 51, 20, 3, 21, 44, 10, 80, 23, 251, 24, 42, 25, 68, 26, 4, 27, 39, 28, 101, 29, 10, 30, 108, 8, 4095, 32, 5, 33, 128
Offset: 0

Views

Author

Alex Ratushnyak, Nov 20 2013

Keywords

Comments

Triangular(k) = k*(k+1)/2.

Crossrefs

Cf. A082183 (least k>0 such that triangular(n) + triangular(k) is a triangular number).
Cf. A232177 (least k>0 such that triangular(n) + triangular(k) is a square).
Cf. A232176 (least k>0 such that n^2 + triangular(k) is a square).
Cf. A101157 (least k>0 such that triangular(n) + k^2 is a triangular number).
Cf. A232178 (least k>=0 such that triangular(n) + k^2 is a square).

Programs

  • Mathematica
    TriangularQ[n_] := IntegerQ[Sqrt[1 + 8*n]]; Table[k = 0; While[! TriangularQ[n^2 + k*(k + 1)/2], k++]; k, {n, 0, 68}] (* T. D. Noe, Nov 21 2013 *)
  • PARI
    a(n) = {my(k = 0); while (! ispolygonal(n^2 + k*(k+1)/2, 3), k++); k;} \\ Michel Marcus, Sep 15 2017
  • Python
    from _future_ import division
    from sympy import divisors
    def A232179(n):
        if n == 0:
            return 0
        t = 2*n**2
        ds = divisors(t)
        for i in range(len(ds)//2-1,-1,-1):
            x = ds[i]
            y = t//x
            a, b = divmod(y-x,2)
            if b:
                return a
        return -1 # Chai Wah Wu, Sep 12 2017
    

Formula

a(A001109(n)) = 0.