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.

A238018 Least k such that the sum triangular(k) + triangular(k+1) +...+ triangular(k+n-1) is a triangular number, or -1 if no such k exists.

This page as a plain text file.
%I A238018 #23 Mar 10 2014 02:25:50
%S A238018 0,0,1,0,2,-1,4,1,0,12,14,-1,11,-1,-1,76,3,28,-1,1,0,33,-1,-1,52,22,4,
%T A238018 29,11,13,5,-1,-1,1,0,74,-1,3,-1,83,-1,-1,76,1006,-1,-1,518,-1,150,-1,
%U A238018 -1,103,133,51,14,45,19,-1,5,-1
%N A238018 Least k such that the sum triangular(k) + triangular(k+1) +...+ triangular(k+n-1) is a triangular number, or -1 if no such k exists.
%e A238018 a(5) = 2 because 2 is the least integer such that the sum of 5 consecutive triangular numbers starting with triangular(2) is a triangular number: 55 = 3+6+10+15+21.
%e A238018 a(7) = 4 because 4 is the least integer such that the sum of 7 consecutive triangular numbers starting with triangular(4) is a triangular number: 210 = 10+15+21+28+36+45+55.
%t A238018 s[n_, k_] := n*(3*k^2 + 3*k*n + n^2 - 1)/6; a[1] = 0; a[n_] := Module[{r}, r = Reduce[ k >= 0 && m >= 0 && 8*s[n, k] + 1 == m^2 , {k, m}, Integers] /. C[1] -> 1 // FullSimplify; If[r === False, -1, k /. {ToRules[r]} // Min]]; Table[a[n], {n, 1, 60}] (* _Jean-François Alcover_, Feb 26 2014 *)
%Y A238018 Cf. A000217, A129803, A238017.
%K A238018 sign
%O A238018 1,5
%A A238018 _Alex Ratushnyak_, Feb 17 2014
%E A238018 More terms from _Jean-François Alcover_, Feb 26 2014