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

A338267 a(n) is the nearest integer to the area of a triangle with sides prime(n), prime(n+1), prime(n+2).

Original entry on oeis.org

0, 6, 13, 38, 71, 108, 159, 218, 317, 436, 550, 697, 817, 961, 1185, 1425, 1667, 1884, 2134, 2377, 2635, 3009, 3438, 3931, 4351, 4645, 4888, 5200, 5778, 6548, 7485, 7955, 8653, 9238, 10033, 10642, 11389, 12151, 12928, 13653, 14570, 15324, 16233, 16683, 17676, 19153, 20963, 22174, 22832, 23620
Offset: 1

Views

Author

Robert Israel, Oct 19 2020

Keywords

Comments

It appears that the area is rational only for n=1.

Examples

			a(3)=13 because the third, fourth and fifth primes are 5,7,11, the area of a triangle with sides 5, 7, 11 is 3*sqrt(299)/4, and the nearest integer to that is 13.
		

Crossrefs

Programs

  • Maple
    atr:= proc(p,q,r) local s; s:= (p+q+r)/2; sqrt(s*(s-p)*(s-q)*(s-r)) end proc:
    P:= [seq(ithprime(i),i=1..102)]:
    seq(round(atr(P[i],P[i+1],P[i+2])),i=1..100);
  • Mathematica
    aTr[{a_,b_,c_}]:=Module[{s=(a+b+c)/2},Round[Sqrt[s(s-a)(s-b)(s-c)]]]; aTr/@Partition[Prime[ Range[ 60]],3,1] (* Harvey P. Dale, Dec 14 2023 *)
  • Python
    from sympy import prime, integer_nthroot
    def A338267(n):
        p, q, r = prime(n)**2, prime(n+1)**2, prime(n+2)**2
        return (integer_nthroot(4*p*q-(p+q-r)**2,2)[0]+2)//4 # Chai Wah Wu, Oct 19 2020

Formula

a(n) = round(sqrt(s*(s-prime(n))*(s-prime(n+1))*(s-prime(n+2)))) where s = (prime(n)+prime(n+1)+prime(n+2))/2.
a(n) = round(sqrt((3/16)*A330096(n))). - Hugo Pfoertner, Oct 19 2020

A338262 Primes p such that the area of the triangle with sides p and the next two primes achieves a record for closeness to a prime.

Original entry on oeis.org

2, 3, 5, 239, 2521, 12239, 121421, 869657, 23638231, 30656909, 47964149, 48203291, 57273361, 552014783, 754751369, 941234383
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Oct 19 2020

Keywords

Examples

			a(3)=5 is in the sequence because 5 is a prime, the triangle with sides 5, 7, 11 has area 3*sqrt(299)/4 whose distance to the nearest prime, 13, is approximately 0.0313, and this is less than any distance previously achieved.
		

Crossrefs

Programs

  • Maple
    atr:= proc(p,q,r) local s; s:= (p+q+r)/2; sqrt(s*(s-p)*(s-q)*(s-r)) end proc:
    R:= 2,3: p:= 3: q:= 5: r:= 7: count:= 2: dmin:= 7 - atr(3,5,7):
    while count < 8 do
    p:= q: q:= r: r:= nextprime(r);
    a:= atr(p,q,r);
    m:= round(a);
    if not isprime(m) then next fi;
    d:= abs(a-m);
    if is(d < dmin) then
      count:= count+1;
      dmin:= d;
      R:= R, p;
    fi
    od:
    R;
  • PARI
    lista(nn) = {my(m=p=3, q=5, s, t); print1(2); forprime(r=7, nn, s=sqrt((p-s=(p+q+r)/2)*(q-s)*(s-r)*s); if(m>t=min(s-precprime(s), nextprime(s)-s), print1(", ", p); m=t); p=q; q=r); } \\ Jinyuan Wang, Oct 24 2020

Extensions

a(10)-a(16) from Jinyuan Wang, Oct 24 2020
Showing 1-2 of 2 results.