login
A236400
Primes p=prime(k) such that min{r_p, p-r_p} <= 2, where r_p = A100612(k).
1
2, 3, 5, 7, 11, 23, 31, 67, 227, 373, 10331, 274453
OFFSET
1,1
COMMENTS
No further terms < 5*10^6. - Michael S. Branicky, Jan 03 2022
LINKS
Romeo Mestrovic, Variations of Kurepa's left factorial hypothesis, arXiv preprint arXiv:1312.7037 [math.NT], 2013-2014.
Miodrag Zivkovic, The number of primes sum_{i=1..n} (-1)^(n-i)*i! is finite, Math. Comp. 68 (1999), pp. 403-409.
MAPLE
A100612 := proc(n)
local p, lf, kf, k ;
p := ithprime(n) ;
lf := 1 ;
kf := 1 ;
for k from 1 to p-1 do
kf := modp(kf*k, p) ;
lf := lf+modp(kf, p) ;
end do:
lf mod p ;
end proc:
for n from 1 do
p := ithprime(n) ;
rp := A100612(n) ;
prp := p-rp ;
if min(rp, prp) <= 2 then
print(p) ;
end if;
end do: # R. J. Mathar, Feb 17 2014
MATHEMATICA
A100612[n_] := Module[{p = Prime[n], lf = 1, kf = 1, k}, For[k = 1, k <= p - 1, k++, kf = Mod[kf*k, p]; lf = lf + Mod[kf, p]]; Mod[lf, p]];
Reap[For[n = 1, n < 40000, n++, p = Prime[n]; rp = A100612[n]; If[Min[rp, p - rp] <= 2, Print[p]; Sow[p]]]][[2, 1]] (* Jean-François Alcover, Dec 05 2017, after R. J. Mathar *)
PROG
(Python)
from sympy import isprime
def afind(limit):
f = 1 # (p-1)!
s = 2 # sum(0! + 1! + ... + (p-1)!)
for p in range(2, limit+1):
if isprime(p):
r_p = s%p
if min(r_p, p-r_p) <= 2:
print(p, end=", ")
s += f*p
f *= p
afind(11000) # Michael S. Branicky, Jan 03 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
N. J. A. Sloane, Jan 29 2014
EXTENSIONS
a(12) from Jean-François Alcover, Dec 05 2017
STATUS
approved