|
|
A153429
|
|
Numbers k such that k! is equal to the sum of two consecutive primes.
|
|
0
|
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
102 is the only known number n such that two numbers n!/2-(n+1) and n!/2+(n+1) are consecutive primes.
|
|
LINKS
|
|
|
EXAMPLE
|
Representations as the sum of two consecutive primes: 4! = (4!/2-1) + (4!/2+1), 5! = (5!/2-1) + (5!/2+1), 27! = (27!/2-107) + (27!/2+107), 77! = (77!/2-397) + (77!/2+397), and 102! = (102!/2-103) + (102!/2+103).
|
|
MATHEMATICA
|
Get["NumberTheory`NumberTheoryFunctions`"];
Do[If[PreviousPrime[n!/2]+NextPrime[n!/2]==n!, Print[n]], {n, 700}]
s2cpQ[n_]:=Module[{c=n!}, c==NextPrime[c/2]+NextPrime[c/2, -1]]; Select[Range[ 110], s2cpQ] (* Harvey P. Dale, Mar 04 2023 *)
|
|
PROG
|
(PARI) is(k) = precprime(k!/2)+nextprime(k!/2) == k! && k>3; \\ Jinyuan Wang, May 30 2020
(Python)
from sympy import isprime, nextprime, prevprime
def ok(n):
if n <= 5: return n == 5
return not isprime(n//2) and n == prevprime(n//2) + nextprime(n//2)
def afind(limit):
factk = 1
for k in range(1, limit+1):
factk *= k
if ok(factk): print(k, end=", ")
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,hard,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|