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.

A354462 a(n) is the least number k such that there are exactly n pairs (p,q) of primes with p

Original entry on oeis.org

1, 4, 15, 315, 420, 825, 2310, 3150, 1785, 8925, 6090, 6405, 8610, 24990, 19305, 12705, 14175, 15015, 18165, 19635, 24255, 48510, 63525, 33915, 48195, 54285, 35490, 50505, 55650, 69615, 71610, 80850, 78540, 103740, 39270, 157920, 60060, 65835, 90090, 147840, 120120, 183645
Offset: 0

Views

Author

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

Keywords

Comments

a(n) is the least solution to A354449(k) = n.

Examples

			a(2) = 15 because for k = 15 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; and 15 is the least k that works.
		

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:
    V:= Array(0..12): count:= 0:
    for n from 1 while count < 13 do
      v:= f(n);
      if v <= 12 and V[v] = 0 then
      count:= count+1; V[v]:= n
    fi
    od:
    convert(V,list);
  • Mathematica
    f[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}]; seq[len_, max_] := Module[{s = Table[0, {len}], n = 1, c = 0, i}, While[c < len && n <= max, i = f[n] + 1; If[i<= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[13, 10^4] (* Amiram Eldar, May 31 2022 *)
  • PARI
    a354449(n) = my(x=2*n, i=0); forprime(q=1, x, forprime(p=1, q-1, if(p+q==x && ispseudoprime(x+p) && ispseudoprime(x+q) && ispseudoprime(p*q-x) && ispseudoprime(p*q+x), i++))); i
    a(n) = for(k=1, oo, if(a354449(k)==n, return(k))) \\ Felix Fröhlich, May 31 2022
    
  • PARI
    upto(n) = {n*=2; v = vector(n\2); forprime(p = 3, n, forprime(q = 3, min(p, n-p), k2 = p+q; if(ispseudoprime(k2+p) && ispseudoprime(k2+q) && ispseudoprime(p*q-k2) && ispseudoprime(p*q+k2), v[k2\2]++ ) ) ); res = [0]; for(i = 1, #v, if(v[i]+1 > #res, res = concat(res, vector(v[i]+1-#res)) ); if(res[v[i]+1] == 0, res[v[i]+1] = i ) ); res } \\ David A. Corneth, Jun 01 2022

Extensions

a(13)-a(32) from Amiram Eldar, May 31 2022
More terms from David A. Corneth, Jun 01 2022