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.

A306678 Number of distinct triangles with prime sides and largest side = prime(n).

Original entry on oeis.org

1, 3, 4, 6, 7, 11, 13, 18, 21, 22, 29, 30, 37, 46, 53, 56, 60, 71, 75, 87, 101, 105, 118, 124, 123, 139, 157, 173, 193, 209, 186, 207, 219, 244, 241, 264, 277, 291, 318, 329, 344, 371, 373, 405, 433, 465, 447, 440, 474, 511, 545, 563, 597, 602, 623, 645
Offset: 1

Views

Author

César Eliud Lozada, Mar 04 2019

Keywords

Examples

			For n=1, there is 1 triangle: {2, 2, 2}, with largest side prime(1) = 2.
For n=2, there are 3 triangles: {2, 2, 3}, {2, 3, 3}, {3, 3, 3}, with largest side prime(2) = 3.
For n=4, there are 6 triangles :{2, 7, 7}, {3, 5, 7}, {3, 7, 7}, {5, 5, 7}, {5, 7, 7}, {7, 7, 7}, with largest side prime(4) = 7. Total = 6 = a(4).
For n=5, largest side = prime(n) = 11. Triangles are {{2, 11, 11}, {3, 11, 11}, {5, 7, 11}, {5, 11, 11}, {7, 7, 11}, {7, 11, 11}, {11, 11, 11}}. Total = 7 = a(5).
		

Crossrefs

Programs

  • Maple
    #nType=1 for acute triangles, nType=2 for obtuse triangles
    #nType=0 for both triangles
    CountPrimeTriangles := proc (n, nType := 1)
      local aa, oo, j, k, sg, a, b, c, tt, lAcute;
      aa := {}; oo := {};
      a := ithprime(n);
      for j from n by -1 to 1 do
        b := ithprime(j);
        for k from j by -1 to 1 do
          c := ithprime(k);
          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 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;
      return sort(`if`(nType = 1, aa, `if`(nType = 2, oo, `union`(aa, oo))))
    end proc:
    # Alternative:
    with(NumberTheory):
    A306678:=proc(n)
        local a,i,p;
        if n=1 then
            1
        else
            a:=0;
            p:=ithprime(n);
            for i from pi(nextprime((p-1)/2)) to n do
                a:=a+i-pi(nextprime(p-ithprime(i)))+1;
            od;
                return a
    	fi;		
    end proc;
    seq(A306678(n),n=1..56); # Felix Huber, Apr 19 2025

Formula

a(n) = A306676(n) + A306677(n).

A378819 a(n) is the number of distinct nondegenerate triangles whose sides are prime factors of n.

Original entry on oeis.org

0, 1, 1, 1, 1, 4, 1, 1, 1, 3, 1, 4, 1, 3, 4, 1, 1, 4, 1, 3, 3, 3, 1, 4, 1, 3, 1, 3, 1, 8, 1, 1, 3, 3, 4, 4, 1, 3, 3, 3, 1, 7, 1, 3, 4, 3, 1, 4, 1, 3, 3, 3, 1, 4, 3, 3, 3, 3, 1, 8, 1, 3, 3, 1, 3, 7, 1, 3, 3, 7, 1, 4, 1, 3, 4, 3, 4, 7, 1, 3, 1, 3, 1, 7, 3, 3, 3, 3
Offset: 1

Views

Author

Felix Huber, Dec 27 2024

Keywords

Comments

A prime factor can be used for several sides.
A nondegenerate triangle is a triangle whose sides (u, v, w) are such that u + v > w, v + w > u and u + w > v.

Examples

			a(10) = 3 because there are the 3 distinct nondegenerate triangles (2, 2, 2), (2, 5, 5), (5, 5, 5) whose sides are prime factors of 10. Since 2 + 2 < 5, (2, 2, 5) is not a triangle.
		

Crossrefs

Programs

  • Maple
    A378819:=proc(n)
       local a,i,j,k,L;
       L:=NumberTheory:-PrimeFactors(n);
       a:=0;
       for i to nops(L) do
          for j from i to nops(L) do
             for k from j to nops(L) while L[k]A378819(n),n=1..88);

Formula

a(n) = a(A007947(n)).
a(p^k) = 1 for prime powers p^k (p prime, k >= 1).

A379663 a(n) is the number of integer-sided triangles whose sides are in geometric progression with smallest side n.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 2, 1, 1, 1, 2, 4, 1, 2, 2, 1, 1, 1, 3, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 3, 5, 4, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 4, 2, 1, 1, 1, 3, 6, 1, 1, 2, 1, 1, 1, 2
Offset: 1

Views

Author

Felix Huber, Jan 07 2025

Keywords

Comments

The integer sides of the triangles are n, n*r, n*r^2 with rational r >= 1. From the triangle inequality n + n*r >= n*r^2 follows r <= (1 + sqrt(5))/2 (golden ratio). Therefore 1 <= r = c/d < (1 + sqrt(5))/2, where c and d are coprimes and d^2 divides n.

Examples

			The a(18) = 2 integer-sided triangles whose sides form a geometric sequence are [18, 18, 18] with r = 1, [18, 24, 32] with r = 4/3.
The a(25) = 4 integer-sided triangles whose sides form a geometric sequence are [25, 25, 25] with r = 1, [25, 30, 36] with r = 6/5, [25, 35, 49] with r = 7/5, [25, 40, 64] with r = 8/5.
The a(36) = 4 integer-sided triangles whose sides form a geometric sequence are [36, 36, 36] with r = 1, [36, 54, 81] with r = 3/2, [36, 48, 64] with r = 4/3, [36, 42, 49] with r = 7/6.
See also the linked Maple program "Triangles for a given n".
		

Crossrefs

Programs

  • Maple
    A379663:=n->floor(2*expand(NumberTheory:-LargestNthPower(n,2))/(1+sqrt(5)))+1;
    seq(A379663(n),n=1..88);

Formula

a(n) = A060143(A000188(n)) + 1.
Showing 1-3 of 3 results.