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.

Showing 1-2 of 2 results.

A229118 Distance from the n-th triangular number to the nearest square.

Original entry on oeis.org

0, 1, 2, 1, 1, 4, 3, 0, 4, 6, 2, 3, 9, 5, 1, 8, 9, 2, 6, 14, 6, 3, 13, 11, 1, 10, 17, 6, 6, 19, 12, 1, 15, 19, 5, 10, 26, 12, 4, 21, 20, 3, 15, 29, 11, 8, 28, 20, 0, 21, 30, 9, 13, 36, 19, 4, 28, 30, 6, 19, 42, 17, 9, 36, 29, 2, 26, 42, 14, 15, 45, 27, 3, 34, 41, 10, 22, 55, 24, 9, 43, 39, 5, 30, 55, 20, 16, 53, 36, 1
Offset: 1

Views

Author

Ralf Stephan, Sep 14 2013

Keywords

Comments

The maximum of a(n)/n appears to converge to sqrt(2)/2 (A010503), i.e. n*(n+1)/2 seems not more than n*sqrt(2)/2 distant from a square.
Some values don't seem to be in the sequence (checked up to n=10^7): 7,18,23,31,37,38...
Those values k are not in the sequence because the Pell-type equations x^2 - 8*y^2 = 8*k+1 and x^2 - 8*y^2 = -8*k+1 have no solutions. - Robert Israel, Apr 08 2019
a(A001108(n)) = 0, a(A229131(n)) = 1, a(A229083(n)) <= 1, a(A229133(n)) is square.

Crossrefs

Programs

  • Mathematica
    dns[n_]:=Module[{a=Floor[Sqrt[n]]^2,b=Ceiling[Sqrt[n]]^2},Min[n-a, b-n]]; dns/@Accumulate[Range[90]] (* Harvey P. Dale, Nov 07 2016 *)
  • PARI
    m=0;for(n=1, 100, t=n*(n+1)/2;s=sqrtint(t);d=min(t-s^2,(s+1)^2-t);print1(d, ","))

A229131 Numbers k such that the distance between the k-th triangular number and the nearest square is exactly 1.

Original entry on oeis.org

1, 2, 4, 5, 15, 25, 32, 90, 148, 189, 527, 865, 1104, 3074, 5044, 6437, 17919, 29401, 37520, 104442, 171364, 218685, 608735, 998785, 1274592, 3547970, 5821348, 7428869, 20679087, 33929305, 43298624
Offset: 1

Views

Author

Ralf Stephan, Sep 15 2013

Keywords

Comments

The k-th triangular number (A000217(k)) is a square plus or minus one.
Union of A006451 (k-th triangular number is a square minus one) and A072221 (k-th triangular number is a square plus one).

Examples

			A000217(4)=10 and 10 - 3^2 = 1 so 4 is in the sequence.
A000217(5)=15 and 4^2 - 15 = 1 so 5 is in the sequence.
		

Crossrefs

Programs

  • PARI
    for(n=1,10^8,for(i=-1,1,f=0;if(i&&issquare(n*(n+1)/2+i),f=1;break));if(f,print1(n,",")))

Formula

G.f.: (-x^7 + 2*x^6 - 2*x^5 + 4*x^4 - 5*x^3 + 2*x^2 + x + 1)/((1-6*x^3+x^6)*(1-x)) (conjectured).
Showing 1-2 of 2 results.