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.

A340463 Primes p such that p*q+r*s+t*u is prime, where p,q,r,s,t,u are consecutive primes.

Original entry on oeis.org

3, 17, 41, 47, 67, 107, 193, 197, 199, 211, 229, 239, 313, 331, 367, 461, 467, 503, 523, 571, 919, 929, 991, 1021, 1039, 1093, 1109, 1163, 1193, 1237, 1277, 1327, 1361, 1381, 1621, 1627, 1783, 1901, 2029, 2099, 2143, 2381, 2389, 2423, 2473, 2663, 2677, 2801, 2917, 2939, 2953, 2957, 2963, 3019
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 08 2021

Keywords

Examples

			a(3)=41 is a term because 41*43+47*53+59*61=7853 is prime, where 41,43,47,53,59,61 are consecutive primes.
		

Crossrefs

Cf. A340464.

Programs

  • Maple
    map(ithprime, select(i -> isprime(ithprime(i)*ithprime(i+1)+ithprime(i+2)*ithprime(i+3)+ithprime(i+4)*ithprime(i+5)), [$1..1000]));
  • Mathematica
    Select[Partition[Prime[Range[500]],6,1],PrimeQ[#[[1]]#[[2]]+#[[3]]#[[4]]+#[[5]]#[[6]]]&][[;;,1]] (* Harvey P. Dale, Jan 10 2025 *)
  • Python
    from sympy import nextprime, isprime
    def aupto(nn):
      alst, consec6 = [], [2, 3, 5, 7, 11, 13]
      p, q, r, s, t, u = consec6; prod = p*q+r*s+t*u
      while p <= nn:
        if isprime(prod): alst.append(p)
        consec6 = consec6[1:] + [nextprime(consec6[-1])]
        p, q, r, s, t, u = consec6; prod = p*q+r*s+t*u
      return alst
    print(aupto(3019)) # Michael S. Branicky, Jan 08 2021

A340465 Primes of the form prime(i)*prime(i+1)+prime(i+2)*prime(i+3)+...+prime(k-1)*prime(k).

Original entry on oeis.org

41, 313, 2137, 6569, 7853, 10133, 10847, 12401, 13757, 14747, 17569, 17911, 24001, 24049, 27901, 31307, 38729, 43177, 43961, 44819, 51607, 69191, 81517, 88379, 104683, 107099, 130631, 137177, 138239, 145967, 154487, 154723, 158777, 162947, 175463, 184409, 192853, 196169, 232499, 243137, 261983
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 08 2021

Keywords

Comments

A prime that has more than one expression of the given form is included only once. The first such prime is a(14353) = 6858604873 = 1979*1987+...+7109*7121 = 19949*19961+...+20231*20233.

Examples

			a(1) = 2*3+5*7 = 41.
a(2) = 3*5+7*11+13*17 = 313.
a(3) = 17*19+23*29+31*37 = 2137.
a(4) = 5*7+11*13+17*19+23*29+31*37+41*43+47*53 = 6569.
a(5) = 41*43+47*53+59*61 = 7853.
		

Crossrefs

Includes A340464.

Programs

  • Maple
    S1:= [0,seq(ithprime(2*i)*ithprime(2*i+1),i=1..100)]:
    P1:= ListTools:-PartialSums(S1):
    S2:= [0,seq(ithprime(2*i-1)*ithprime(2*i),i=1..100)]:
    P2:= ListTools:-PartialSums(S2):
    M:= 2*max(S1):
    S:= select(t -> t < M and isprime(t), {seq(seq(P1[i]-P1[j],j=i mod 2 + 1 .. i-2,2),i=1..101)} union {seq(seq(P2[i]-P2[j],j=i mod 2 + 1..i-2,2),i=1..101)} union {seq(P2[i],i=1..101,2)}):
    sort(convert(S,list));
  • Python
    from sympy import isprime, nextprime, prime
    def sp2(lst):
      ans = 0
      for i in range(0, len(lst), 2): ans += lst[i]*lst[i+1]
      return ans
    def aupto(nn):
      alst, i = [], 1
      while True:
        consec2i = [prime(j+1) for j in range(2*i)]; sp = sp2(consec2i)
        if sp > nn: break
        while sp <= nn:
          if isprime(sp): alst.append(sp)
          consec2i = consec2i[1:] + [nextprime(consec2i[-1])]; sp = sp2(consec2i)
        i += 1
      return sorted(alst)
    print(aupto(261983)) # Michael S. Branicky, Jan 08 2021
Showing 1-2 of 2 results.