login
A058233
Primes p such that p#+1 is divisible by the next prime after p.
9
2, 17, 1459, 2999
OFFSET
1,1
COMMENTS
No additional terms through the 100000th prime. - Harvey P. Dale, Mar 12 2014
a(5) > prime(1400000) = 22182343. - Robert Price, Apr 02 2018
From Carlo Corti, Apr 13 2026: (Start)
a(5) > prime(26355867) = 499999993. Search also finds (p#+1) mod nextprime(p) <= 100 for 179 primes p <= 499999993.
The only prime p in (7, 499999993] with nextprime(p) | (p#-1) is p = 176078267, confirming Whiteside's 2005 results (see Rivera link). (End)
To explore beyond the limit of prime(14820001) known since 2005 (cf. Rivera link), or the new limit of prime(28e6) ~ 5e8, it may seem at first not practicable to store the entire primorial (which uses about 100 MB for the 2005 limit or twice that for the new one), and that one should use modular arithmetic instead. However, recomputing the entire primorial from scratch by making >= 28e6 modular multiplications for each new prime p actually takes longer than to multiply and thereafter divide (for the mod operation) a 200 MB sized number. A more efficient approach would be to store several smaller "chunks" of products of consecutive primes. These chunks can be taken modulo p' = nextprime(p) in parallel and only reading from memory, which is faster than writing. Only the last chunk has to be written to memory as long as it is growing up to the size limit. - M. F. Hasler, Apr 14 2026
LINKS
Carlos Rivera, Puzzle 117: Certain p#+1 values, The Prime Puzzles and Problems Connection.
EXAMPLE
2*3*5*7*11*13*17 + 1 is divisible by 19.
MATHEMATICA
primorial[n_] := Product[ Prime[k], {k, 1, PrimePi[n]}]; Select[ Prime[ Range[1000]], Divisible[ primorial[#] + 1, NextPrime[#]] &] (* Jean-François Alcover, Aug 19 2013 *)
Module[{prs=Prime[Range[500]]}, Transpose[Select[Thread[{Rest[ FoldList[ Times, 1, prs]], prs}], Divisible[ First[#]+1, NextPrime[Last[#]]]&]][[2]]] (* Harvey P. Dale, Mar 12 2014 *)
PROG
(Python)
from sympy import nextprime
A058233_list, p, q, r = [], 2, 3, 2
for _ in range(10**3):
if (r+1) % q == 0:
A058233_list.append(p)
r *= q
p, q = q, nextprime(q) # Chai Wah Wu, Sep 27 2021
(PARI) select( {is_A058233(p, q=Mod(2, nextprime(p+1)))=forprime(p=3, p, q*=p); q==-1}, primes(500)) \\ For efficiency, p is assumed to be prime [one can easily wrap if(isprime(p), ...) around the function body], and it is possible to directly pass Mod(2, nextprime) as second optional argument, to speed up scanning a list of consecutive primes. - M. F. Hasler, Apr 14 2026
CROSSREFS
KEYWORD
nice,nonn,more
AUTHOR
Carlos Rivera, Dec 01 2000
STATUS
approved