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.

A339920 Primes p such that p^2 - p*q + q^2 is prime, where q is the next prime after p.

Original entry on oeis.org

2, 3, 53, 151, 167, 263, 373, 443, 467, 509, 523, 571, 1063, 1103, 1117, 1217, 1493, 1553, 1901, 1973, 2161, 2207, 2281, 2399, 2713, 2837, 2963, 3259, 3347, 3511, 4073, 4297, 4373, 4463, 4523, 4673, 4691, 4877, 5147, 5237, 5303, 5419, 5471, 5851, 6211, 6311, 6367
Offset: 1

Views

Author

Michel Marcus, Dec 23 2020

Keywords

Comments

From Bernard Schott, Dec 23 2020: (Start)
Except for a(2)=3, (3, 5) gives A339698(2) = 19, there is no other pair of twin primes (p, p+2) (p in A001359) that gives a prime number of the form p^2-p*q+q^2 = p^2+2p+4.
There are no consecutive cousin primes (p, p+4) (p in A029710) that gives a prime number of the form p^2-pq+q^2 = p^2+4p+16.
There are no consecutive primes with a gap of 8 (p, p+8) (p in A031926) that give a prime number of the form p^2-pq+q^2 = p^2+8p+64. (End)

Crossrefs

Cf. A339698.

Programs

  • Maple
    q:= 2: count:= 0: R:= NULL:
    while count < 100 do
      p:= q; q:= nextprime(q);
      if isprime(p^2-p*q+q^2) then
        count:= count+1; R:= R, p;
      fi
    od:
    R; # Robert Israel, Dec 24 2020
  • PARI
    forprime(p=1, 1e4, my(q=nextprime(p+1)); if(ispseudoprime(p^2-p*q+q^2), print1(p, ", ")));

A342706 Primes of the form (p^2 - p*q + q^2)/3, where p and q are consecutive primes.

Original entry on oeis.org

13, 31, 79, 109, 151, 1201, 3271, 3469, 3889, 4111, 12289, 16879, 17791, 25951, 27673, 108301, 126079, 134857, 138679, 169957, 174259, 186019, 231877, 245389, 259309, 355009, 367501, 371737, 397489, 412939, 461017, 477619, 524197, 544429, 565069, 602401, 741031, 833191, 904303, 961069, 1267501
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Mar 18 2021

Keywords

Examples

			For n = 5, p = 19 and q = 23 are consecutive primes and a(5) = (19^2-19*23+23^2)/3 = 151 is prime.
		

Crossrefs

Programs

  • Maple
    R:= NULL: q:= 2: count:= 0:
    while count<100 do
      p:= q; q:= nextprime(p);
      r:= (p^2-p*q+q^2)/3;
      if r::integer and isprime(r) then
        count:= count+1; R:= R, r;
      fi;
    od:
    R;
  • Mathematica
    cpQ[{a_,b_}]:=Module[{c=(a^2-a*b+b^2)/3},If[PrimeQ[c],c,Nothing]]; cpQ/@Partition[Prime[ Range[ 500]],2,1] (* Harvey P. Dale, Dec 31 2023 *)
  • Python
    from sympy import isprime, nextprime
    def aupto(limit):
      p, q, num, alst = 3, 5, 7, []
      while num//3 <= limit:
        if num%3 == 0 and isprime(num//3): alst.append(num//3)
        p, q, num = q, nextprime(q), p**2 - p*q + q**2
      return alst
    print(aupto(1267501)) # Michael S. Branicky, Mar 18 2021
Showing 1-2 of 2 results.