%I #54 Aug 15 2023 17:02:01
%S 0,1,4,6,1,10,13,9,21,17,2,5,4,16,18,13,28,22,65,68,55,20,27,76,80,13,
%T 50,43,65,109,56,81,93,134,82,10,131,4,30,104,29,170,104,165,9,122,
%U 130,42,225,50,69,12,128,60,147,52,16,56,7,218,154,264,198,48,299,205,251,101
%N a(n) = (0! + 1! + ... + (p-1)!) mod p, where p = prime(n).
%C The greedy inverse (indices of first occurrence of 1, 2, 3, ... in the sequence) is 2, 11, 91, 3, 12, 4, 59, -1, 8, 6, -1, 52, 7, 2550, -1, 14, 10, 15, 5461, 22, 9, 18, 205, 141, 4178, -1, 23, 17, 41, 39, -1, 5297, 937, -1, -1, -1, -1, 5248, 213, -1, 90, 48, 28, 4202, -1, 1718, 313, 64, 119, 27, ... where -1 means the number does not exist or is larger than 8000. - _R. J. Mathar_, Dec 19 2016
%C a(12397) = 31; a(54708) = 37. - _Michel Marcus_, May 11 2019
%C a(105527) = 35. - _Michel Marcus_, May 13 2019
%C a(16728884) = 26; a(62860131) = 35; sent by Milos Tatarevic. - _Michel Marcus_, May 18 2019
%D R. K. Guy, Unsolved Problems in Number Theory, B44: is a(n)>0 for n>2?
%H Michel Marcus, <a href="/A100612/b100612.txt">Table of n, a(n) for n = 1..2000</a>
%H Vladica Andrejic and Milos Tatarevic, <a href="https://arxiv.org/abs/1409.0800">Searching for a counterexample to Kurepa's Conjecture</a>, arXiv:1409.0800 [math.NT], 2014-2015.
%H Vladica Andrejic, Alin Bostan, Milos Tatarevic, <a href="https://arxiv.org/abs/1904.09196">Improved algorithms for left factorial residues</a>, arXiv:1904.09196 [math.NT], 2019.
%H Luis H. Gallardo, <a href="https://web.math.pmf.unizg.hr/~duje/radhazumz/preprints/gallardo-preprint.pdf">Artin-Schreier, Erdős, and Kurepa’s conjecture</a>, 2023.
%H Romeo Mestrovic, <a href="http://arxiv.org/abs/1312.7037">Variations of Kurepa's left factorial hypothesis</a>, arXiv preprint arXiv:1312.7037 [math.NT], 2013-2014.
%H T. D. Noe, <a href="/A100612/a100612.gif">Plot of first 5000 terms</a> (The red line gives prime(n). There are very few duplicate values in the sequence; the 5000 terms have 4476 values.)
%F a(n) = A236399(n) mod prime(n).
%F a(n) = A067462(prime(n)) + 1, unless A067462(prime(n)) == - 1 (mod n). - _Michel Marcus_, May 05 2019
%p lf:=n->add(k!,k=0..n-1);
%p [seq(lf(ithprime(n)) mod ithprime(n),n=1..100)];
%p # 2nd program:
%p A100612 := proc(n)
%p local p,f,a,k;
%p f := 1 ;
%p a := 0 ;
%p p := ithprime(n) ;
%p for k from 0 to p-1 do
%p a := modp(a+f,p) ;
%p f := modp(f*(k+1),p) ;
%p end do:
%p a ;
%p end proc:
%p seq(A100612(n),n=1..50) ; # _R. J. Mathar_, Dec 19 2016
%t Table[Mod[Total[Range[0,n-1]!],n],{n,Prime[Range[70]]}] (* _Harvey P. Dale_, May 06 2013 *)
%o (PARI) a(n) = {my(p = prime(n), v = vector(p-1, k, Mod(k, p))); for (k=2, p-1, v[k] *= v[k-1];); lift(1+vecsum(v));} \\ _Michel Marcus_, May 05 2019
%Y See A049782 for more information. See also A003422, A236399.
%Y Cf. A067462.
%K nonn
%O 1,3
%A _N. J. A. Sloane_, Dec 02 2004