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

A000328 Number of points of norm <= n^2 in square lattice.

Original entry on oeis.org

1, 5, 13, 29, 49, 81, 113, 149, 197, 253, 317, 377, 441, 529, 613, 709, 797, 901, 1009, 1129, 1257, 1373, 1517, 1653, 1793, 1961, 2121, 2289, 2453, 2629, 2821, 3001, 3209, 3409, 3625, 3853, 4053, 4293, 4513, 4777, 5025, 5261, 5525, 5789, 6077, 6361, 6625
Offset: 0

Views

Author

Keywords

Comments

Number of ordered pairs of integers (x,y) with x^2 + y^2 <= n^2.

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • H. Gupta, A Table of Values of N_3(t), Proc. National Institute of Sciences of India, 13 (1947), 35-63.
  • C. D. Olds, A. Lax and G. P. Davidoff, The Geometry of Numbers, Math. Assoc. Amer., 2000, p. 47.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Column k=2 of A302997.
Equals A051132 + A046109. For another version see A057655.

Programs

  • Haskell
    a000328 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 <= n^2]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Mathematica
    Table[Sum[SquaresR[2, k], {k, 0, n^2}], {n, 0, 46}]
  • PARI
    { a(n) = 1 + 4 * sum(j=0,n^2\4, n^2\(4*j+1) - n^2\(4*j+3) ) } /* Max Alekseyev, Nov 18 2007 */
    
  • Python
    def A000328(n):
        return (sum([int((n**2 - y**2)**0.5) for y in range(1, n)]) * 4 + 4*n + 1)
        # Karl-Heinz Hofmann, Aug 03 2022
    
  • Python
    from math import isqrt
    def A000328(n): return 1+(sum(isqrt(k*((n<<1)-k)) for k in range(1,n+1))<<2) # Chai Wah Wu, Feb 12 2025

Formula

a(n) = 1 + 4 * Sum_{j>=0} floor(n^2/(4*j+1)) - floor(n^2/(4*j+3)). Also a(n) = A057655(n^2). - Max Alekseyev, Nov 18 2007
a(n) = 4*A000603(n) - (4*n+3), n >= 0. - Wolfdieter Lang, Mar 15 2015
a(n) = 1+4*n^2-4*ceiling((n-1)/sqrt(2))-8*A247588(n-1), n>1. - Mats Granvik, May 23 2015
a(n) = [x^(n^2)] theta_3(x)^2/(1 - x), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 14 2018
Limit_{n->oo} a(n)/n^2 = Pi. - Chai Wah Wu, Feb 12 2025

Extensions

More terms from David W. Wilson, May 22 2000
Edited at the suggestion of Max Alekseyev by N. J. A. Sloane, Nov 18 2007
Incorrect comment removed by Eric M. Schmidt, May 28 2015

A247587 Number of obtuse triangles with integer sides at most n.

Original entry on oeis.org

0, 0, 1, 2, 4, 8, 13, 20, 30, 42, 57, 74, 95, 120, 149, 182, 219, 261, 309, 362, 420, 485, 556, 632, 715, 806, 906, 1012, 1125, 1247, 1377, 1517, 1666, 1824, 1993, 2170, 2358, 2555, 2765, 2986
Offset: 1

Views

Author

Vladimir Letsko, Sep 20 2014

Keywords

Examples

			a(4) = 2 because there are 2 obtuse triangles with integer sides less than or equal to 4: (2,2,3); (2,3,4).
		

Crossrefs

Programs

  • Maple
    tr_o:=proc(n) local a, b, c, t, d; t:=0:
      for a to n do
      for b from a to n do
      for c from b to min(a+b-1, n) do
      d:=a^2+b^2-c^2:
      if d<0 then t:=t+1 fi
      od od od;
      [n, t]; end;
  • PARI
    a(n)=sum(a=2,n-1,sum(b=a,n-1,max(0,min(n,a+b-1)-sqrtint(a^2+b^2)))) \\ Charles R Greathouse IV, Sep 20 2014
    
  • PARI
    obtuse(n)=sum(a=2,n-1, max(0, sqrtint(n^2-1-a^2)-max(a,n-a+1)+1))
    s=0; vector(100,n, s+=obtuse(n)) \\ Charles R Greathouse IV, Sep 20 2014

A236384 Number of non-congruent integer triangles with base length n whose apex lies on or within a space bounded by a semicircle of diameter n.

Original entry on oeis.org

0, 0, 1, 1, 3, 4, 5, 7, 10, 13, 15, 17, 22, 25, 30, 33, 38, 42, 48, 54, 58, 65, 71, 76, 85, 92, 100, 106, 114, 123, 130, 140, 149, 159, 170, 177, 189, 197, 211, 222, 231, 243, 255, 269, 282, 292, 306, 318, 333, 348, 364, 378, 391, 406, 420, 438, 453, 470, 485
Offset: 1

Views

Author

Frank M Jackson, Jan 24 2014

Keywords

Comments

Number of integer-sided obtuse or right (non-acute) triangles with largest side n. - Frank M Jackson, Dec 03 2014

Examples

			a(5)=3 as there are 3 non-congruent integer triangles with base length 5 whose apex lies on or within the space bounded by the semicircle of diameter 5. The integer triples are (2,4,5), (3,3,5), (3,4,5).
		

Crossrefs

Programs

  • GeoGebra
    c = Slider(1, 20, 1);
    L = Flatten(Sequence(Sequence(((a^2+c^2-(c-a+k)^2)/(2c),((a+(c-a+k)+c)(a+(c-a+k)-c)(a-(c-a+k)+c)(-a+(c-a+k)+c))^(1/2)/(2c)),a,k,(c+k)/2),k,1,c));
    C = {Circle((c/2,0),c/2)};
    a_n = CountIf(IsInRegion((x(A),y(A)),Element(C,1)),A,L);
    # Frank M Jackson, Jan 01 2024
  • Mathematica
    sumtriangles[c_] := (n=0; Do[If[a^2+b^2<=c^2, n++], {b, 1, c}, {a, c-b+1, b}]; n); Table[sumtriangles[m], {m, 1, 200}]
  • PARI
    a(n)=sum(a=2,n,sum(b=max(a,n+1-a),n,a^2+b^2<=n^2)) \\ Charles R Greathouse IV, Mar 26 2014
    
  • PARI
    a(n)=sum(a=2,n,max(min(sqrtint(n^2-a^2),n)-max(a,n+1-a)+1,0)) \\ Charles R Greathouse IV, Mar 26 2014
    

Formula

a(n) = A002620(n+1)-A247588(n). - Frank M Jackson, Dec 03 2014

A247586 Number of acute triangles with integer sides less than or equal to n.

Original entry on oeis.org

1, 3, 6, 11, 17, 25, 36, 49, 64, 81, 102, 127, 154, 185, 219, 258, 301, 349, 401, 457, 520, 587, 660, 740, 824, 914, 1010, 1114, 1225, 1342, 1468, 1600, 1740, 1887, 2041, 2206, 2378, 2561, 2750, 2948
Offset: 1

Views

Author

Vladimir Letsko, Sep 20 2014

Keywords

Examples

			a(2) = 3 because there are 3 acute triangles with integer sides less than or equal to 2: (1,1,1); (1,2,2); (2,2,2).
		

Crossrefs

Programs

  • Maple
    tr_a:=proc(n) local a,b,c,t,d;t:=0:
      for a to n do
      for b from a to n do
      for c from b to min(a+b-1,n) do
      d:=a^2+b^2-c^2:
      if d>0 then t:=t+1 fi
      od od od;
      [n,t]; end;
  • Mathematica
    a[n_] := Module[{a, b, c, d, t = 0}, Do[d = a^2 + b^2 - c^2; If[d>0, t++], {a, n}, {b, a, n}, {c, b, Min[a+b-1, n]}]; t]; Array[a, 40] (* Jean-François Alcover, Jun 19 2019, from Maple *)
  • Python
    import itertools
    def A247586(n):
        I = itertools.combinations_with_replacement(range(1,n+1),3)
        F = filter(lambda c: c[0]**2 + c[1]**2 > c[2]**2, I)
        return len(list(F))
    print([A247586(n) for n in range(41)]) # Peter Luschny, Sep 22 2014

A255195 Triangle describing the shape of one eighth of the Gauss circle problem.

Original entry on oeis.org

1, 2, 0, 2, 1, 0, 2, 1, 1, 0, 2, 1, 2, 0, 0, 2, 1, 1, 2, 0, 0, 2, 1, 1, 2, 1, 0, 0, 2, 1, 1, 2, 2, 0, 0, 0, 2, 1, 1, 2, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2, 2, 1, 0, 0, 0, 2, 1, 1, 1, 2, 1, 2, 1, 0, 0, 0, 2, 1, 1, 1, 2, 1, 2, 2, 0, 0, 0, 0, 2, 1, 1, 1, 2, 1, 2, 2, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Mats Granvik, Feb 16 2015

Keywords

Comments

The sum of terms of row n is n.
Total of partial sums in reverse (from right to left) equals one eighth of the Gauss circle problem. Whenever there is the number 2 the border of the circle makes a jump upwards. Predicting where the 2's are would say something about the Gauss circle problem. The number of 2's equals the number of 0's in the same row, and is counted by A194920(n-1).

Examples

			1,
2, 0,
2, 1, 0,
2, 1, 1, 0,
2, 1, 2, 0, 0,
2, 1, 1, 2, 0, 0,
2, 1, 1, 2, 1, 0, 0,
2, 1, 1, 2, 2, 0, 0, 0,
2, 1, 1, 2, 1, 2, 0, 0, 0,
2, 1, 1, 1, 2, 2, 1, 0, 0, 0,
2, 1, 1, 1, 2, 1, 2, 1, 0, 0, 0,
2, 1, 1, 1, 2, 1, 2, 2, 0, 0, 0, 0,
2, 1, 1, 1, 2, 1, 2, 2, 1, 0, 0, 0, 0
		

Crossrefs

Programs

  • Mathematica
    Flatten[Table[Sum[Table[If[And[If[n^2 + k^2 <= r^2, If[n >= k, 1, 0], 0] == 1, If[(n + 1)^2 + (k + 1)^2 <= r^2, If[n >= k, 1, 0], 0]== 0], 1, 0], {k, 0, r}], {n, 0, r}], {r, 0, 12}]]

Formula

A000603(n) = 2*(Sum_{k=1..n} Sum_{k=1..k} T(n,n-k+1))-ceiling((n-1)/sqrt(2)) for n>1.
A247588(n-1) = (Sum_{k=1..n} Sum_{k=1..k} (T(n,k) - T(n,n-k+1))/2).

A306673 a(n) is the number of distinct, non-similar acute triangles with integer sides and largest side <= n.

Original entry on oeis.org

1, 2, 4, 7, 12, 16, 26, 34, 46, 56, 76, 90, 116, 135, 161, 187, 229, 257, 308, 344, 394, 439, 511, 558, 636, 698, 779, 849, 959, 1027, 1152, 1245, 1362, 1465, 1603, 1703, 1874, 2004, 2164, 2298, 2507, 2639, 2867, 3034, 3235, 3421, 3690, 3866, 4147, 4354
Offset: 1

Views

Author

César Eliud Lozada, Mar 04 2019

Keywords

Examples

			For n=4, there are 9 acute triangles with integer sides and largest side <= 4. These have sides {a,b,c} = {1, 1, 1}, {1, 2, 2}, {1, 3, 3}, {1, 4, 4}, {2, 2, 2}, {2, 2, 4}, {2, 3, 3}, {3, 3, 4}, {3, 4, 4}. But {2, 2, 2} is similar to {1,1,1} and {2,2,4} is similar to {1,1,2}, so these two triangles are excluded from the list and therefore a(4)=7.
		

Crossrefs

Programs

  • Maple
    #nType=1 for acute triangles, nType=2 for obtuse triangles, nType=0 for both triangles
    CountTriangles := proc (n, nType := 1)
      local aa, oo, a, b, c, tt, lAcute;
      aa := {}; oo := {};
      for a from n by -1 to 1 do for b from a by -1 to 1 do for c from b by -1 to 1 do
        if a < b+c and abs(b-c) < a and b < c+a and abs(c-a) < b and c < a+b and abs(a-b) < c and gcd(a, gcd(b, c)) = 1 then
          lAcute := evalb(0 < b^2+c^2-a^2);
          tt := sort([a, b, c]);
          if lAcute then aa := {op(aa), tt} else oo := {op(oo), tt} end if
        end if
      end do end do end do;
      return sort(`if`(nType = 1, aa, `if`(nType=2,oo,`union`(aa,oo))))
    end proc
  • Mathematica
    Length@Select[DeleteDuplicates[Sort@# & /@ Tuples[Range@#, 3]], GCD @@ # == 1 && #[[1]] + #[[2]] > #[[3]] && #[[1]]^2 + #[[2]]^2 > #[[3]]^2 &] & /@ Range@50 (* Hans Rudolf Widmer, Dec 07 2023 *)

A247589 Number of integer-sided obtuse triangles with largest side n.

Original entry on oeis.org

0, 0, 1, 1, 2, 4, 5, 7, 10, 12, 15, 17, 21, 25, 29, 33, 37, 42, 48, 53, 58, 65, 71, 76, 83, 91, 100, 106, 113, 122, 130, 140, 149, 158, 169, 177, 188, 197, 210, 221, 230, 243, 255, 269, 281, 292, 306, 318, 333, 346
Offset: 1

Views

Author

Vladimir Letsko, Sep 20 2014

Keywords

Examples

			a(5) = 2 because there are 2 integer-sided acute triangles with largest side 5: (2,4,5); (3,3,5).
		

Crossrefs

Programs

  • Maple
    tr_o:=proc(n) local a,b,t,d;t:=0:
    for a to n do
    for b from max(a,n+1-a) to n do
    d:=a^2+b^2-n^2:
    if d<0 then t:=t+1 fi
    od od;
    t; end;

Formula

a(n) = k*(k + (1+(-1)^n)/2) + Sum_{j=1..floor(n*(1-sqrt(2)/2))} floor(sqrt(2*j*n - j^2 - 1) - j), where k = floor((2*n*(sqrt(2) - 1) + 1 - (-1)^n)/4) (it appears that k(n) is A070098(n)). - Anton Nikonov, Sep 29 2014

A251607 Number of non-congruent integer triangles ABC with largest side BC of length n whose opposite vertex A lies inside the closed boundary formed by BC and a locus of points whose real distance from B is x, from C is y and x^3 + y^3 = n^3.

Original entry on oeis.org

0, 0, 1, 2, 3, 5, 8, 10, 14, 16, 20, 24, 29, 35, 39, 45, 51, 58, 66, 71, 80, 87, 97, 104, 115, 124, 133, 145, 154, 166, 178, 189, 202, 213, 228, 241, 254, 269, 283, 297, 315, 329, 346, 361, 380, 396, 413, 431, 450, 470, 487, 508, 528, 548, 569, 588, 613, 632, 655, 677, 701
Offset: 1

Views

Author

Frank M Jackson, Dec 05 2014

Keywords

Comments

Acute integer triangles ABC with longest side BC of length n (A247588) are segregated from obtuse or right integer triangles with the same longest side BC (A236384) by the closed boundary formed by a semicircle and BC as its diameter. The right integer triangles will lie on this boundary and the obtuse integer triangles within this boundary. Define a closed boundary S(q) that is formed by BC and a locus of points whose real distance from B is x, from C is y and x^q + y^q = n^q for integer q > 0. Then S(2) is that closed boundary formed by a semicircle with BC as diameter. Euler proved that there are no integer triangles that lie on S(3) and Wiles for all S(q) where q > 2. This sequence identifies all integer triangles with longest side BC of length n that lie inside S(3).

Examples

			a(5)=3 as there are 3 non-congruent integer triangles with base length of 5 whose apex lies inside S(3). The integer triples are (3,3,5), (2,4,5), (3,4,5). The other triangles from the complete set of non-congruent integer triangles with longest side length 5 (A002620(5+1)) are (4,4,5), (1,5,5), (2,5,5), (3,5,5), (4,5,5), (5,5,5) and lie outside the closed boundary.
		

Crossrefs

Programs

  • GeoGebra
    n = Slider(1, 20, 1);
    L = Flatten(Sequence(Sequence(((a^2+n^2-(n-a+k)^2)/(2n),((a+(n-a+k)+n)(a+(n-a+k)-n)(a-(n-a+k)+n)(-a+(n-a+k)+n))^(1/2)/(2n)),a,k,(n+k)/2),k,1,n));
    p = 3;
    C = Curve((a^2+n^2-(n^p-a^p)^(2/p))/(2n),((a+(n^p-a^p)^(1/p)+n)(a+(n^p-a^p)^(1/p)-n)(a-(n^p-a^p)^(1/p)+n)(-a+(n^p-a^p)^(1/p)+n))^(1/2)/(2n),a,0,n);
    a_n = CountIf((x(A)^2+y(A)^2)^(p/2)+((n-x(A))^2+y(A)^2)^(p/2)Frank M Jackson, Jan 02 2024
  • Mathematica
    sumtriangles[c_] := (n = 0; Do[If[a^3+b^3c, n++], {b, 1, c}, {a, 1, b}]; n); Table[sumtriangles[m], {m, 1, 200}]
Showing 1-8 of 8 results.