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.

This page as a plain text file.
%I A232179 #15 Sep 15 2017 03:20:03
%S A232179 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,
%T A232179 8,14,2,15,1023,16,59,0,24,18,66,19,51,20,3,21,44,10,80,23,251,24,42,
%U A232179 25,68,26,4,27,39,28,101,29,10,30,108,8,4095,32,5,33,128
%N A232179 Least k >= 0 such that n^2 + triangular(k) is a triangular number.
%C A232179 Triangular(k) = k*(k+1)/2.
%H A232179 Chai Wah Wu, <a href="/A232179/b232179.txt">Table of n, a(n) for n = 0..10000</a>
%F A232179 a(A001109(n)) = 0.
%t A232179 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 *)
%o A232179 (Python)
%o A232179 from __future__ import division
%o A232179 from sympy import divisors
%o A232179 def A232179(n):
%o A232179     if n == 0:
%o A232179         return 0
%o A232179     t = 2*n**2
%o A232179     ds = divisors(t)
%o A232179     for i in range(len(ds)//2-1,-1,-1):
%o A232179         x = ds[i]
%o A232179         y = t//x
%o A232179         a, b = divmod(y-x,2)
%o A232179         if b:
%o A232179             return a
%o A232179     return -1 # _Chai Wah Wu_, Sep 12 2017
%o A232179 (PARI) a(n) = {my(k = 0); while (! ispolygonal(n^2 + k*(k+1)/2, 3), k++); k;} \\ _Michel Marcus_, Sep 15 2017
%Y A232179 Cf. A000217, A000290, A001109.
%Y A232179 Cf. A082183 (least k>0 such that triangular(n) + triangular(k) is a triangular number).
%Y A232179 Cf. A232177 (least k>0 such that triangular(n) + triangular(k) is a square).
%Y A232179 Cf. A232176 (least k>0 such that n^2 + triangular(k) is a square).
%Y A232179 Cf. A101157 (least k>0 such that triangular(n) + k^2 is a triangular number).
%Y A232179 Cf. A232178 (least k>=0 such that triangular(n) + k^2 is a square).
%K A232179 nonn
%O A232179 0,3
%A A232179 _Alex Ratushnyak_, Nov 20 2013