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.

A239969 Least positive k such that triangular(n) + triangular(n+k) is a triangular number (A000217), or -1 if no such k exists.

Original entry on oeis.org

2, 5, 1, 3, 20, 2, 4, 16, 3, 5, 31, 4, 6, 119, 5, 7, 16, 6, 8, 103, 7, 9, 2, 8, 10, 26, 9, 11, 464, 10, 12, 1, 11, 13, 313, 12, 5, 58, 13, 15, 37, 14, 3, 493, 15, 17, 31, 16, 18, 47, 17, 2, 79, 9, 20, 796, 19, 21, 883, 20, 22, 89, 4, 23, 58, 22, 24, 100, 23, 25, 1276
Offset: 3

Views

Author

Alex Ratushnyak, Mar 30 2014

Keywords

Comments

In other words, smallest solution k>0 to 4*k^2 + 8*(k + 1)*n + 8*n^2 + 4*k + 1 = m^2. - Ralf Stephan, Apr 01 2014

Examples

			a(3) = 2 because triangular(3)+triangular(3+2)=21 is a triangular number.
a(5) = 1 because triangular(5)+triangular(5+1)=36 is a triangular number.
In other words, k=a(3)=2 is the smallest positive solution to 4*k^2 + 28*k + 97 = m^2, and k=a(5)=1 is the smallest positive solution to 4*k^2 + 44*k + 241 = m^2.
		

Crossrefs

Programs

  • Haskell
    a239969 n = head [k | k <- [1..],
                          a010054 (a000217 n + a000217 (n + k)) == 1]
    -- Reinhard Zumkeller, Apr 03 2014
  • PARI
    triangular(n) = n*(n+1)/2;
    is_triangular(n) = issquare(8*n+1);
    s=[]; for(n=3, 100, k=1; while(!is_triangular(triangular(n)+triangular(n+k)), k++); s=concat(s, k)); s \\ Colin Barker, Mar 31 2014
    

Extensions

First PROG corrected by Colin Barker, Apr 04 2014