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

A064784 Difference between n-th triangular number t(n) and the largest square <= t(n).

Original entry on oeis.org

0, 2, 2, 1, 6, 5, 3, 0, 9, 6, 2, 14, 10, 5, 20, 15, 9, 2, 21, 14, 6, 28, 20, 11, 1, 27, 17, 6, 35, 24, 12, 44, 32, 19, 5, 41, 27, 12, 51, 36, 20, 3, 46, 29, 11, 57, 39, 20, 0, 50, 30, 9, 62, 41, 19, 75, 53, 30, 6, 66, 42, 17, 80, 55, 29, 2, 69, 42, 14, 84, 56, 27, 100, 71, 41, 10, 87, 56
Offset: 1

Views

Author

Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 20 2001

Keywords

Comments

The second differences of a(n) - (a(n)-a(n-1))-(a(n-1)-a(n-2)) - give 2, -2, -1, 6, -6, -1, -1, 12, -12, -1, 16, -16, -1 ... 82k+2, 82k-2, -1, 82k+6, 82k-6, -1, -1, 82k+12, 82k-12, -1, 82k+16, -82k-16, -1, 82k+20, -82k-20, -1, -1, 82k+26, -82k-26, -1, 82k+30, -82k-30, -1, -1, 82k+36, -82k-36, -1, 82k+40, -82k-40, -1, 82k+44, -82k-44, -1, -1, 82k+50, -82k-50, -1, 82k+54, -82k-54, -1, -1, 82k+60, -82k-60, -1, 82k+64, -82k-64, -1, -1, 82k+70, -82k-70, -1, 82k+74, -82k-74, -1, 82k+78, -82k-78, -1, -1, ...

Examples

			n = 5: A000217(5) = 28, largest square below that is 25, so a(5) = 28 - 25 = 3.
		

Crossrefs

Cf. A001108, A076816, A128549, A230038. Unique values are in A230044.

Programs

  • Maple
    seq(n*(n+1)/2-floor(sqrt(n*(n+1)/2))^2,n=0..100);
  • Mathematica
    f[n_]:=n*(n+1)/2-Floor[Sqrt[n*(n+1)/2]]^2; lst={}; Do[AppendTo[lst,f[n]],{n,0,6!}]; lst (* Vladimir Joseph Stephan Orlovsky, Feb 17 2010 *)
    #-Floor[Sqrt[#]]^2&/@Accumulate[Range[100]] (* Harvey P. Dale, Oct 15 2014 *)
  • PARI
    { default(realprecision, 100); for (n=1, 1000, t=n*(n + 1)/2; a=t - floor(sqrt(t))^2; write("b064784.txt", n, " ", a) ) } \\ Harry J. Smith, Sep 25 2009
    
  • Python
    from math import isqrt
    def A064784(n): return (m:=n*(n+1)>>1)-isqrt(m)**2 # Chai Wah Wu, Jun 01 2024

Formula

a(n) = n*(n+1)/2 - floor(sqrt(n*(n+1)/2))^2.
a(n) = A053186(A000217(n)). - R. J. Mathar, Sep 10 2016
a(A001108(n)) = 0. - Hugo Pfoertner, Jun 01 2024

Extensions

Definition corrected by Harry J. Smith, Sep 25 2009
Terms corrected by Harry J. Smith, Sep 25 2009

A373327 Records of A064784.

Original entry on oeis.org

0, 2, 6, 9, 14, 20, 21, 28, 35, 44, 51, 57, 62, 75, 80, 84, 100, 104, 107, 126, 129, 131, 132, 155, 156, 182, 209, 237, 266, 291, 321, 344, 375, 396, 428, 461, 480, 514, 531, 566, 602, 617, 654, 667, 705, 744, 755, 795, 804, 845, 852, 894, 937, 942, 986, 989, 1034
Offset: 1

Views

Author

Hugo Pfoertner, Jun 01 2024

Keywords

Crossrefs

A373328 gives the corresponding positions.

Programs

  • Maple
    R:= 0: m:= 0: count:= 1:
    for i from 1 while count < 100 do
      t:= i*(i+1)/2;
      v:= t - floor(sqrt(t))^2;
      if v > m then
        R:= R,v; m:= v; count:= count+1;
      fi
    od:
    R; # Robert Israel, Dec 19 2024
  • PARI
    a373327(nmax) = {my(m=-oo); for(n=0, nmax, my(T=n*(n+1)/2, d=T-sqrtint(T)^2); if(d>m, print1(d, ", "); m=d))};
    a373327(750)

A373328 Numbers k such that the difference between T = k*(k+1)/2 = A000217(k) and the largest square <= T reaches a new record.

Original entry on oeis.org

0, 2, 5, 9, 12, 15, 19, 22, 29, 32, 39, 46, 53, 56, 63, 70, 73, 80, 87, 90, 97, 104, 111, 114, 121, 131, 155, 172, 189, 213, 230, 254, 271, 295, 312, 329, 353, 370, 394, 411, 428, 452, 469, 493, 510, 527, 551, 568, 592, 609, 633, 650, 667, 691, 708, 732, 749, 766
Offset: 1

Views

Author

Hugo Pfoertner, Jun 01 2024

Keywords

Crossrefs

A373327 gives the corresponding differences.

Programs

  • Maple
    J:= 0: m:= 0: count:= 1:
    for i from 1 while count < 100 do
      t:= i*(i+1)/2;
      v:= t - floor(sqrt(t))^2;
      if v > m then
        J:= J,i; m:= v; count:= count+1;
       fi
    od:
    J; # Robert Israel, Dec 19 2024
  • PARI
    a373328(nmax) = {my(m=-oo); for(n=0, nmax, my(T=n*(n+1)/2, d=T-sqrtint(T)^2); if(d>m, print1(n, ", "); m=d))};
    a373328(770)
Showing 1-3 of 3 results.