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

A379033 Numbers that are the product of exactly three (not necessarily distinct) primes and these primes are sides of a nondegenerate triangle.

Original entry on oeis.org

8, 12, 18, 27, 45, 50, 75, 98, 105, 125, 147, 175, 242, 245, 338, 343, 363, 385, 429, 507, 539, 578, 605, 637, 715, 722, 845, 847, 867, 969, 1001, 1058, 1083, 1105, 1183, 1309, 1331, 1445, 1547, 1573, 1587, 1615, 1682, 1729, 1805, 1859, 1922, 2023, 2057, 2185, 2197
Offset: 1

Views

Author

Felix Huber, Dec 24 2024

Keywords

Comments

Subsequence of A014612 and of A145784.
Numbers that are the product of exactly three (not necessarily distinct) primes and these primes are sides of a degenerate triangle are in A071142.

Examples

			12 = 2*2*3 is in the sequence because 2 + 2 > 3.
20 = 2*2*5 is not in the sequence because 2 + 2 < 5.
30 = 2*3*5 is not in the sequence because 2 + 3 = 5.
		

Crossrefs

Programs

  • Maple
    A379033:=proc(n)
       option remember;
       local a,i,j,P;
       if n=1 then
          8
       else
          for a from procname(n-1)+1 do
             P:=[];
             if NumberTheory:-Omega(a)=3 then
                for i in ifactors(a)[2] do
                   j:=0;
                   while jP[3] then
                   return a
                fi
             fi
          od
       fi	
    end proc;
    seq(A379033(n),n=1..51);

A385736 a(n) is the number of distinct nondegenerate triangles with perimeter n whose side lengths are triangular numbers.

Original entry on oeis.org

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

Views

Author

Felix Huber, Jul 16 2025

Keywords

Comments

0, 1, 6, 10, 28, 55 are the only triangular numbers <= 10^6 that are not perimeters of triangles whose side lengths are triangular numbers. Conjecture: There are no other triangular numbers that have this property.

Examples

			The a(31) = 2 distinct nondegenerate triangles with perimeter 31 and whose side lengths are triangular numbers are [1, 15, 15] and [6, 10, 15].
		

Crossrefs

Programs

  • Maple
    A385736:=proc(N) # To get the first N + 1 terms.
        local p,x,y,z,i;
        p:=[];
        for z to floor((sqrt(24*N+9)-3)/6) do
            for x from z to floor((sqrt(4*N-3)-1)/2) do
                for y from max(z,floor((sqrt(1+4*(x^2+x-z^2-z))-1)/2)+1) to min(x,floor((sqrt(1+4*(2*N-x^2-x-z^2-z))-1)/2)) do
                    p:=[op(p),z*(z+1)/2+y*(y+1)/2+x*(x+1)/2]
                od
            od
        od;
        return seq(numboccur(p,i),i=0..N)
    end proc;
    A385736(87);

Formula

Trivial upper bound: a(n) <= A005044(n).
a(A385737(n)) >= 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.

A376348 a(n) is the number of multisets with n primes with which an n-gon with perimeter prime(n) can be formed.

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 7, 7, 12, 19, 19, 25, 44, 72, 72, 119, 147, 152, 234, 292, 435, 777, 920, 946, 1135, 1161, 1377, 3702, 4293, 5942, 5942, 10741, 10741, 14483, 18953, 22091, 28658, 37686, 37686, 63053, 63053, 72389, 72389, 132732, 233773, 265312, 265312, 300443, 373266
Offset: 3

Views

Author

Felix Huber, Oct 13 2024

Keywords

Comments

a(n) is the number of partitions of prime(n) into n prime parts < prime(n)/2.
First differs from A259254 at n=31: a(31) = 3702 but A259254(31) = 3703.

Examples

			a(7) = 2 because exactly the 2 partitions (2, 2, 2, 2, 3, 3, 3) and (2, 2, 2, 2, 2, 2, 5) have 7 prime parts and their sum is p(7) = 17.
		

Crossrefs

Programs

  • Maple
    A376348:=proc(n)
       local a,p,x,i;
       a:=0;
       p:=ithprime(n);
       for x from NumberTheory:-pi(p/n)+1 to NumberTheory:-pi(p/2) do
          a:=a+numelems(select(i->nops(i)=n-1 and andmap(isprime,i),combinat:-partition(ithprime(n)-ithprime(x),ithprime(x))))
       od;
       return a
    end proc;
    seq(A376348(n),n=3..42);
  • PARI
    a(n)={my(m=prime(n), p=primes(primepi((m-1)\2))); polcoef(polcoef(1/prod(i=1, #p, 1 - y*x^p[i], 1 + O(x*x^m)), m),n)} \\ Andrew Howroyd, Oct 13 2024

Extensions

a(43) onwards from Andrew Howroyd, Oct 13 2024

A378675 Areas of trapezoids with exactly one pair of parallel sides having prime sides and height.

Original entry on oeis.org

15, 21, 27, 27, 45, 45, 55, 63, 65, 81, 85, 85, 95, 99, 115, 117, 125, 125, 135, 145, 155, 171, 175, 175, 185, 189, 205, 207, 225, 235, 243, 245, 265, 275, 279, 295, 297, 315, 315, 325, 333, 335, 355, 365, 385, 387, 405, 407, 425, 451, 455, 459, 473, 475, 475
Offset: 1

Views

Author

Felix Huber, Dec 04 2024

Keywords

Examples

			27 is twice in the sequence because there are two distinct trapezoids [p, d, q, f, h] (p and q are parallel, height h) with prime sides and height and area 27: [13, 5, 5, 5, 3], [11, 3, 7, 5, 3].
		

Crossrefs

Programs

  • Maple
    with(NumberTheory):
    A378675:=proc(A)
       local m,p,q,i,j,d,f,h,x,y,M,T;
       if isprime(A)=false and A>1 then
          T:=[];
          M:=map(x->A/x,select(isprime,(Divisors(A)) minus {2}));
          for m in M do
             for i to pi(floor(m-1/2)) do
                q:=ithprime(i);
                p:=2*m-q;
                if isprime(p) then
                   h:=A/m;
    	       for x from max(4,floor((p-q+1)/2)) by 2 to (h^2-1)/2 do
    	          y:=p-q-x;
    	          if issqr(x^2+h^2) and issqr(y^2+h^2) then
    	             d:=isqrt(y^2+h^2);
    	             f:=isqrt(x^2+h^2);
    	             if isprime(d) and isprime(f) then
    	                T:=[op(T),A]
    	             fi
    	          fi
    	       od
    	    fi
             od
          od;
          return op(T)
       fi;
    end proc;
    seq(A378675(A),A=1..475);
Showing 1-7 of 7 results.