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-5 of 5 results.

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).

A354329 Triangular number nearest to the sum of the first n positive triangular numbers.

Original entry on oeis.org

0, 1, 3, 10, 21, 36, 55, 78, 120, 171, 210, 276, 351, 465, 561, 666, 820, 990, 1128, 1326, 1540, 1770, 2016, 2278, 2628, 2926, 3240, 3655, 4095, 4465, 4950, 5460, 5995, 6555, 7140, 7750, 8385, 9180, 9870, 10731, 11476, 12403, 13203, 14196, 15225, 16290, 17205
Offset: 0

Views

Author

Paolo Xausa, Jun 04 2022

Keywords

Examples

			a(4) = 21 because the sum of the first 4 positive triangular numbers is 1 + 3 + 6 + 10 = 20, and the nearest triangular number is 21.
		

Crossrefs

Programs

  • Mathematica
    nterms=100;Table[t=Floor[Sqrt[n(n+1)(n+2)/3]];(t^2+t)/2,{n,0,nterms-1}]
  • PARI
    a(n)=my(t=sqrtint(n*(n+1)*(n+2)/3));(t^2+t)/2;
    vector(100,n,a(n-1))
    
  • Python
    from math import isqrt
    def A354329(n): return (m:=isqrt(n*(n*(n + 3) + 2)//3))*(m+1)>>1 # Chai Wah Wu, Jul 15 2022

Formula

a(n) = (t^2+t)/2, where t = floor(sqrt(n*(n+1)*(n+2)/3)).

A229083 Numbers k such that the distance between the k-th triangular number and the nearest square is at most 1.

Original entry on oeis.org

1, 2, 4, 5, 8, 15, 25, 32, 49, 90, 148, 189, 288, 527, 865, 1104, 1681, 3074, 5044, 6437, 9800, 17919, 29401, 37520, 57121, 104442, 171364, 218685, 332928, 608735, 998785, 1274592, 1940449, 3547970, 5821348, 7428869, 11309768, 20679087, 33929305, 43298624, 65918161
Offset: 1

Views

Author

Ralf Stephan, Sep 13 2013

Keywords

Comments

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

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.
A000217(8) = 36 = 6^2 so 8 is in sequence.
		

Crossrefs

Programs

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

Formula

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

A229117 Numbers k where d/k reaches a new record, with d the distance from the k-th triangular number to the nearest square.

Original entry on oeis.org

2, 3, 13, 20, 37, 78, 119, 218, 457, 696, 1273, 2666, 4059, 7422, 15541, 23660, 43261, 90582, 137903, 252146, 527953, 803760, 1469617, 3077138, 4684659, 8565558, 17934877, 27304196, 49923733, 104532126, 159140519, 290976842
Offset: 1

Views

Author

Ralf Stephan, Sep 14 2013

Keywords

Comments

Positions of records of A229118(n)/n.
The maximum of d/k appears to converge to sqrt(2)/2 (A010503), i.e., k*(k+1)/2 is not more than k*sqrt(2)/2 distant from a square.

Examples

			G.f. = 2*x + 3*x^2 + 13*x^3 + 20*x^4 + 37*x^5 + 78*x^6 + 119*x^7 + 218*x^8 + ...
		

Crossrefs

Programs

  • Magma
    m:=50; R:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(2 +x+10*x^2-5*x^3+11*x^4-19*x^5+x^6-2*x^7+3*x^8)/(1-x-6*x^3+6*x^4+x^6- x^7))); // G. C. Greubel, Aug 09 2018
  • Mathematica
    Drop[CoefficientList[Series[x*(2 + x + 10*x^2 - 5*x^3 + 11*x^4 - 19*x^5 + x^6 - 2*x^7 + 3*x^8)/(1 - x - 6*x^3 + 6*x^4 + x^6 - x^7), {x, 0, 50}], x], 1] (* G. C. Greubel, Aug 09 2018 *)
  • PARI
    m=0;for(n=1, 10^9, t=n*(n+1)/2;s=sqrtint(t);d=min(t-s^2,(s+1)^2-t);r=d/n;if(r>m,m=r;print1(n, ",")))
    
  • PARI
    {a(n) = if( n<1, 0, polcoeff( (1 + x + x^2 + 4*x^3 + x^4 + 11*x^5 - 18*x^6 - 2*x^8 + 3*x^9) / (1 - x - 6*x^3 + 6*x^4 + x^6 - x^7) + x * O(x^n), n))}; /* Michael Somos, Dec 25 2016 */
    

Formula

G.f.: x * (2 + x + 10*x^2 - 5*x^3 + 11*x^4 - 19*x^5 + x^6 - 2*x^7 + 3*x^8) / (1 - x - 6*x^3 + 6*x^4 + x^6 - x^7). - Michael Somos, Dec 25 2016
a(n) = a(n-1) + 6*a(n-3) - 6*a(n-4) - a(n-6) + a(n-7) if n>9. - Michael Somos, Dec 25 2016

A229133 Numbers k such that the distance between the k-th triangular number and the nearest square is a square.

Original entry on oeis.org

1, 2, 4, 5, 6, 8, 9, 13, 15, 17, 25, 32, 39, 49, 52, 54, 56, 63, 64, 80, 87, 89, 90, 95, 98, 100, 104, 111, 128, 135, 144, 148, 152, 153, 159, 176, 183, 189, 200, 207, 224, 225, 230, 231, 233, 248, 255, 272, 279, 285, 288, 296, 303, 305, 319, 320, 327, 329, 344, 351, 368, 369, 370, 374, 375
Offset: 1

Views

Author

Ralf Stephan, Sep 15 2013

Keywords

Comments

A229118(a(n)) is a perfect square.

Examples

			The nearest square to 6*7/2=21 is 25 and |21-25| = 2^2 so 6 is in the sequence.
The nearest square to 7*8/2=28 is 25 and |28-25| = 3 so 7 is not in the sequence.
		

Crossrefs

Programs

  • Mathematica
    tnsQ[n_]:=Module[{tno=(n(n+1))/2,sr,a,b},sr=Sqrt[tno];a=tno-Floor[sr]^2;b=Ceiling[sr]^2-tno;IntegerQ[Sqrt[Min[{a,b}]]]]; Select[Range[400],tnsQ] (* Harvey P. Dale, Mar 26 2015 *)
Showing 1-5 of 5 results.