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.

A350523 Prime numbers p such that K(p) = 0! + 1! + ... + (p-1)! == -2 (mod p).

This page as a plain text file.
%I A350523 #21 Jan 29 2022 10:29:00
%S A350523 2,3,23,67,227,10331
%N A350523 Prime numbers p such that K(p) = 0! + 1! + ... + (p-1)! == -2 (mod p).
%C A350523 The Kurepa Conjecture says that K(p) is nonzero in F_p, the finite field with p elements. Primes for which K(p) takes some fixed nonzero value in F_p might have some interest.
%C A350523 No further terms < 6*10^6. - _Michael S. Branicky_, Jan 03 2022
%H A350523 Vladica Andrejić, Alin Bostan and Milos Tatarevic, <a href="https://doi.org/10.1016/j.ipl.2020.106078">Improved algorithms for left factorial residues</a>, Information Processing Letters, Vol. 167 (2021), Article ID 106078, 4 p.; <a href="https://arxiv.org/abs/1904.09196">arXiv preprint</a>, arXiv:1904.09196 [math.NT], 2019-2020.
%t A350523 q[p_] := PrimeQ[p] && Divisible[Sum[k!, {k, 0, p - 1}] + 2, p]; Select[Range[230], q] (* _Amiram Eldar_, Jan 03 2022 *)
%o A350523 (Python)
%o A350523 from sympy import isprime
%o A350523 def K(n):
%o A350523     ans, f = 0, 1
%o A350523     for i in range(1, n+1):
%o A350523         ans += f%n
%o A350523         f = (f*i)%n
%o A350523     return ans%n
%o A350523 def ok(n): return isprime(n) and (K(n) + 2)%n == 0
%o A350523 print([k for k in range(11000) if ok(k)]) # _Michael S. Branicky_, Jan 03 2022
%o A350523 (Python) # faster version for initial segment of sequence
%o A350523 from sympy import isprime
%o A350523 def afind(limit):
%o A350523     f = 1 # (p-1)!
%o A350523     s = 2 # sum(0! + 1! + ... + (p-1)!)
%o A350523     for p in range(2, limit+1):
%o A350523         if isprime(p) and s%p == p-2:
%o A350523             print(p, end=", ")
%o A350523         s += f*p
%o A350523         f *= p
%o A350523 afind(11000) # _Michael S. Branicky_, Jan 03 2022
%Y A350523 Cf. A003422, A100612.
%Y A350523 Subsequence of A236400.
%K A350523 nonn,more
%O A350523 1,1
%A A350523 _Luis H. Gallardo_, Jan 03 2022