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.

A339698 Primes of the form p^2 - p*q + q^2, where p and q are consecutive primes.

Original entry on oeis.org

7, 19, 3163, 23743, 28927, 70783, 141403, 198943, 223837, 265333, 283267, 329503, 1136383, 1223263, 1254427, 1488427, 2238043, 2421163, 3625243, 3904603, 4709143, 4884127, 5216683, 5784133, 7376683, 8065627, 8797183, 10660333, 11242717, 12348223, 16613803, 18594019, 19202167, 19999027
Offset: 1

Views

Author

Zak Seidov, Dec 13 2020

Keywords

Examples

			a(2) = 19 = 3^2 - 3*5 + 5^2 is the only prime obtained with a pair of twin primes: (3, 5). - _Bernard Schott_, Dec 23 2020
		

Crossrefs

Cf. A243761 (similar, with p^2 + p*q + q^2), A339920 (the primes p).

Programs

  • Mathematica
    Select[Map[#1^2 - #1 #2 + #2^2 & @@ # &, Partition[Prime@ Range[610], 2, 1]], PrimeQ] (* Michael De Vlieger, Dec 13 2020 *)
  • PARI
    forprime(p=1, 1e4, my(q=nextprime(p+1), x=p^2-p*q+q^2); if(ispseudoprime(x), print1(x, ", "))) \\ Felix Fröhlich, Dec 14 2020
    
  • PARI
    first(n) = { my(q = 2, p, res = vector(n), t = 0); forprime(p = 3, oo, c = p^2 - p*q + q^2; if(isprime(c), t++; res[t] = c; if(t >= n, return(res) ) ); q = p; ) } \\ David A. Corneth, Dec 19 2020

A342705 Primes p such that (p^2 - p*q + q^2)/3 is prime, where q is the next prime after p.

Original entry on oeis.org

5, 7, 13, 17, 19, 59, 97, 101, 107, 109, 191, 223, 229, 277, 283, 569, 613, 631, 643, 709, 719, 743, 829, 857, 881, 1031, 1049, 1051, 1091, 1109, 1171, 1193, 1249, 1277, 1301, 1327, 1489, 1579, 1637, 1697, 1949, 1979, 2003, 2081, 2089, 2113, 2141, 2203, 2357, 2423, 2539, 2593, 2659, 2749, 2789, 2819
Offset: 1

Views

Author

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

Keywords

Comments

If p == -q (mod 3) then p^2 - p*q + q^2 is divisible by 3.

Examples

			a(5) = 19 is a term because 19 and 23 are consecutive primes and (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, p;
      fi;
    od:
    R;
  • Python
    from sympy import isprime, nextprime
    def aupto(limit):
      p, q, num, alst = 2, 3, 7, []
      while  p <= limit:
        if num%3 == 0 and isprime(num//3): alst.append(p)
        p, q = q, nextprime(q)
        num = p**2 - p*q + q**2
      return alst
    print(aupto(2819)) # Michael S. Branicky, Mar 18 2021
Showing 1-2 of 2 results.