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.

A356178 Numbers k such that both Sum_{i=1..k} i*prime(i) and Sum_{i=1..k} (k+1-i)*prime(i) are prime.

Original entry on oeis.org

1, 3, 199, 351, 1583, 1955, 2579, 2627, 3251, 3407, 3503, 5311, 6359, 6819, 7295, 7547, 8791, 9663, 10143, 10591, 11499, 11579, 12199, 12443, 14527, 15563, 15583, 16051, 16543, 16655, 18047, 18319, 20691, 20847, 23979, 24079, 24575, 25667, 26491, 28235, 30395, 30627, 32235, 32259, 33091, 33287, 33527
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jul 28 2022

Keywords

Comments

Numbers k such that A014148(k) and A014285(k) are both prime.
a(n) == 3 (mod 4) for n > 1.

Examples

			a(2) = 3 is a term because Sum_{i=1..3} i*prime(i) = 1*2 + 2*3 + 3*5 = 23 and Sum_{i=1..3} (4-i)*prime(i) = 3*2 + 2*3 + 1*5 = 17 are prime.
		

Crossrefs

Programs

  • Maple
    S1:= 2: S2:= 2: S3:= 2*S2-S1: R:= 1: count:= 1: p:= 2:
    for n from 2 to 40000 do
      p:= nextprime(p);
      S1:= S1 + n*p;
      S2:= S2 + p;
      if n mod 4 = 3 and isprime(S1) then
        S3:= (n+1)*S2 - S1;
        if isprime(S3) then
           count:= count+1; R:= R, n;
        fi
      fi;
    od:
    R;
  • Mathematica
    r = Range[35000]; p = Prime[r]; Intersection[Position[Accumulate[r*p], ?PrimeQ], Position[Accumulate[Accumulate[p]], ?PrimeQ]] // Flatten (* Amiram Eldar, Jul 28 2022 *)
  • PARI
    isok(k) = my(vp=primes(k)); isprime(sum(i=1, k, i*vp[i])) && isprime(sum(i=1, k, (k+1-i)*vp[i])); \\ Michel Marcus, Jul 29 2022