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

A354449 a(n) is the number of pairs of primes (p,q) with p

Original entry on oeis.org

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

Views

Author

J. M. Bergot and Robert Israel, May 31 2022

Keywords

Examples

			a(15) = 2 as there are two such pairs, (7,23) and (13,17): 2*15+7 = 37, 2*15+23 = 53, 7*23-2*15 = 131, 7*23+2*15 = 191, 2*15+13 = 43, 2*15+17 = 47, 13*17-2*15 = 191 and 13*17+2*15 = 251 are all prime.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local count,p,q;
      p:= 2*n-1 ; count:= 0;
      do
        p:= prevprime(p);
        if p < n then return count fi;
        q:= 2*n-p;
        if isprime(q) and isprime(2*n+q) and isprime(2*n+p) and isprime(p*q-2*n) and isprime(p*q+2*n) then count:=count+1 fi;
      od
    end proc:
    f(1):= 0: f(2):= 0:
    map(f, [$1..100]);
  • Mathematica
    a[n_] := Sum[If[AllTrue[{k, 2*n - k, 2*n + k, 4*n - k, k*(2 n - k) - 2*n, k*(2 n - k) + 2*n}, PrimeQ], 1, 0], {k, 1, n}]; Array[a, 100] (* Amiram Eldar, May 31 2022 *)
  • PARI
    a(n) = sum(k=1, n, ispseudoprime(k) && ispseudoprime(2*n-k) && ispseudoprime(2*n+k) && ispseudoprime(4*n-k) && ispseudoprime(k*(2*n-k)-2*n) && ispseudoprime(k*(2*n-k)+2*n)) \\ adapted from Mathematica code, Felix Fröhlich, May 31 2022
Showing 1-1 of 1 results.