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

A358742 First of three consecutive primes p,q,r such that p^3 + q^3 - r^3 is prime.

Original entry on oeis.org

13, 29, 89, 97, 127, 137, 151, 163, 199, 223, 241, 277, 313, 349, 367, 389, 419, 431, 457, 463, 521, 577, 613, 691, 823, 827, 829, 859, 877, 883, 911, 953, 971, 1049, 1087, 1097, 1129, 1151, 1163, 1217, 1409, 1489, 1499, 1579, 1699, 1723, 1867, 1879, 1993, 2089, 2111, 2141, 2293, 2339, 2399, 2411
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Nov 29 2022

Keywords

Comments

Note: for x >= 3275, there is a prime between x and x(1 + 1/(2 log^2 x)) < 1.01x (Dusart 1998). Together with finite checking this shows that for p > 19, p^3 + q^3 - r^3 > 0. - Charles R Greathouse IV, Nov 29 2022

Examples

			a(3) = 89 is a term because 89, 97, 101 are consecutive primes and 89^3 + 97^3 - 101^3 = 587341 is prime.
		

Crossrefs

Programs

  • Maple
    R:= NULL: count:= 0: q:= 2: r:= 3:
    while count < 100 do
      p:= q; q:= r; r:=nextprime(r);
      if isprime(p^3+q^3-r^3) then count:= count+1; R:= R,p; fi;
    od:
    R;
  • Mathematica
    Select[Partition[Prime[Range[360]], 3, 1], (s = #[[1]]^3 + #[[2]]^3 - #[[3]]^3) > 0 && PrimeQ[s] &][[;; , 1]] (* Amiram Eldar, Nov 29 2022 *)
  • PARI
    a358742(upto) = {my(p1=2, p2=3); forprime(p3=5, upto, if (isprime (p1^3+p2^3-p3^3), print1(p1,", ")); p1=p2; p2=p3)};
    a358742(2500) \\ Hugo Pfoertner, Nov 29 2022
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def agen():
        p, q, r = 2, 3, 5
        while True:
            if isprime(p**3 + q**3 - r**3): yield p
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 56))) # Michael S. Branicky, Nov 29 2022
    

A358744 First of three consecutive primes p, q, r such that p + q - r, p^2 + q^2 - r^2 and p^3 + q^3 - r^3 are all prime.

Original entry on oeis.org

13, 29, 137, 521, 577, 691, 823, 1879, 3469, 4799, 8783, 21569, 25453, 26263, 26591, 27529, 27919, 34607, 39509, 45631, 48869, 53653, 56099, 56633, 57641, 63313, 63809, 67733, 68819, 74381, 76031, 76421, 94781, 97187, 98873, 101279, 105683, 110291, 118967, 119569, 119849, 120577, 123737, 128951
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Nov 29 2022

Keywords

Examples

			a(3) = 137 is a term because 137, 139, 149 are consecutive primes and
137^1 + 139^1 - 149^1 = 127,
137^2 + 139^2 - 149^2 = 15889,
and 137^3 + 139^3 - 149^3 = 1949023 are all prime.
		

Crossrefs

Intersection of A358743, A255581 and A358742.

Programs

  • Maple
    R:= NULL: count:= 0: q:= 2: r:= 3:
    while count < 100 do
      p:= q; q:= r; r:=nextprime(r);
      if isprime(p+q-r) and isprime(p^2+q^2-r^2) and isprime(p^3+q^3-r^3) then count:= count+1; R:= R,p fi;
    od:
    R;
  • Mathematica
    Select[Partition[Prime[Range[13000]], 3, 1], AllTrue[Table[#[[1]]^k + #[[2]]^k - #[[3]]^k, {k, 1, 3}], PrimeQ] &][[;; , 1]] (* Amiram Eldar, Nov 29 2022 *)
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def agen():
        p, q, r = 2, 3, 5
        while True:
            if all(isprime(t) for t in [p+q-r, p**2+q**2-r**2, p**3+q**3-r**3]):
                yield p
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 44))) # Michael S. Branicky, Nov 29 2022

A358745 a(n) is the least prime p that is the first of three consecutive primes p, q, r such that p^i + q^i - r^i is prime for i from 1 to n but not n+1.

Original entry on oeis.org

2, 7, 41, 13, 4799, 45631, 332576273, 157108359787, 4001045161
Offset: 0

Views

Author

J. M. Bergot and Robert Israel, Nov 29 2022

Keywords

Comments

For any prime x, if p == r (mod x) and q <> x, or q == r (mod x) and p <> x, p^i + q^i - r^i is not divisible by x. Thus there is no modular obstruction to the sequence being infinite.
If a(9) exists, then it exceeds 8*10^12. - Lucas A. Brown, Mar 08 2024

Examples

			a(3) = 13 because 13, 17, 19 are consecutive primes with 13 + 17 - 19 = 11, 13^2 + 17^2 - 19^2 = 97 and 13^3 + 17^3 - 19^3 = 251 are prime but 13^4 + 17^4 - 19^4 = -18239 is not, and no prime less than 13 works.
		

Crossrefs

Programs

  • Maple
    V:= Array(0..5):
    q:= 2: r:= 3: count:= 0:
    while count < 6 do
      p:= q; q:= r; r:= nextprime(r);
      for i from 1 while isprime(p^i+q^i-r^i) do od:
      if V[i-1] = 0 then V[i-1]:= p; count:= count+1 fi;
    od:
    convert(V,list);
  • PARI
    a(n) = my(p=2, q=nextprime(p+1)); forprime(r=nextprime(q+1), oo, my(c=0); for(k=1, oo, if(isprime(p^k + q^k - r^k), c+=1, break)); if(c==n, return(p)); p = q; q = r); \\ Daniel Suteu, Jan 04 2023

Extensions

a(6) from Michael S. Branicky, Nov 29 2022
a(7) from Daniel Suteu, Jan 04 2023
Showing 1-3 of 3 results.