OFFSET
0,1
COMMENTS
a(n) <= 3*n-3, because triangular(3*n-3) + triangular(4*n-3) = triangular(5*n-4).
In other words, smallest k>0 such that 8*k^2 + 4*(2*k + 1)*n + 4*n^2 + 8*k + 1 = m^2 has an integer solution. - Ralf Stephan, Apr 01 2014
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
EXAMPLE
n=5: the smallest solution k>0 to 8*k^2 + 64*k + 225 = m^2 is k=4, so a(5)=4.
MATHEMATICA
tr[n_]:=(n(n+1))/2; lpk[n_]:=Module[{k=1}, While[!OddQ[Sqrt[8(tr[k]+tr[n+k])+1]], k++]; k]; Array[lpk, 70, 0] (* Harvey P. Dale, Nov 11 2024 *)
PROG
(PARI) triangular(n) = n*(n+1)/2;
is_triangular(n) = issquare(8*n+1);
s=[]; for(n=0, 100, k=1; while(!is_triangular(triangular(k)+triangular(n+k)), k++); s=concat(s, k)); s \\ Colin Barker, Mar 31 2014
(PARI) a(n)=my(k=1); while(!ispolygonal(k*(k+n+1)+(n^2+n)/2, 3), k++); k \\ Charles R Greathouse IV, Apr 01 2014
(Haskell)
a239970 n = head [k | k <- [1..],
a010054 (a000217 k + a000217 (n + k)) == 1]
-- Reinhard Zumkeller, Apr 03 2014
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Alex Ratushnyak, Mar 30 2014
EXTENSIONS
First PROG corrected by Colin Barker, Apr 04 2014
STATUS
approved