login
a(n) = (0! + 1! + ... + (n-1)!) mod n.
10

%I #90 Aug 27 2023 19:25:43

%S 0,0,1,2,4,4,6,2,1,4,1,10,10,6,4,10,13,10,9,14,13,12,21,10,14,10,10,6,

%T 17,4,2,26,1,30,34,10,5,28,10,34,4,34,16,34,19,44,18,10,48,14,13,10,

%U 13,10,34,34,28,46,28,34,22,2,55,26,49,34,65,30,67,34,68,10,55,42,64,66,34

%N a(n) = (0! + 1! + ... + (n-1)!) mod n.

%C Kurepa's conjecture is that gcd(!n,n!) = 2, n > 1. It is easy to prove that this is equivalent to showing that gcd(p,!p) = 1 for all odd primes p. In Guy, 2nd edition, it is stated that Mijajlovic has tested up to p = 10^6. Subsequently Gallot tested up to 2^26. I have continued up to just above p = 2^27, in fact to p < 144000000. There were no examples found where gcd(p,!p) > 1. - Paul Jobling, Dec 02 2004

%C According to Kellner, the conjecture has been proved by Barsky and Benzaghou. - _T. D. Noe_, Dec 02 2004

%C Barsky and Benzaghou withdrew their proof in 2011. I've extended the search up to 10^9; no counterexample was found. - _Milos Tatarevic_, Feb 01 2013

%D R. K. Guy, Unsolved Problems in Number Theory, B44: is a(n) > 0 for n > 2?

%H T. D. Noe, <a href="/A049782/b049782.txt">Table of n, a(n) for n = 1..10000</a>

%H Romeo Mestrovic, <a href="https://doi.org/10.2298/FIL1510207M">The Kurepa-Vandermonde matrices arising from Kurepa's left factorial hypothesis</a>, Filomat 29:10 (2015), 2207-2215. DOI:10.2298/FIL1510207M

%H Vladica Andrejic, Milos Tatarevic, <a href="http://arxiv.org/abs/1409.0800">Searching for a counterexample of Kurepa's Conjecture</a>, arXiv:1409.0800 [math.NT], 2014.

%H D. Barsky and B. Benzaghou, <a href="http://dx.doi.org/10.5802/jtnb.432">Nombres de Bell et somme de factorielles</a>, Journal de Théorie des Nombres de Bordeaux, 16:1, No. 17, 2004.

%H D. Barsky and B. Benzaghou, <a href="http://dx.doi.org/10.5802/jtnb.775">Erratum à l'article "Nombres de Bell et somme de factorielles"</a>, Journal de Théorie des Nombres de Bordeaux, 23:2 (2011), p. 527.

%H Y. Gallot, <a href="http://yves.gallot.pagesperso-orange.fr/papers/lfact.pdf">More information</a>.

%H Bernd C. Kellner, <a href="https://arxiv.org/abs/math/0410477">Some remarks on Kurepa's left factorial</a>, arXiv:math/0410477 [math.NT], 2004.

%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 Stephen A. Silver, <a href="https://web.archive.org/web/20150315105524/http://www.argentum.freeserve.co.uk/maths/a049782.c">C program to generate this sequence</a>.

%H M. Tatarevic, <a href="http://mtatar.wordpress.com/2011/07/30/kurepa/">Searching for a counterexample to the Kurepa's left factorial hypothesis (p < 10^9)</a>.

%F a(n) = A003422(n) mod n = !n mod n. - _G. C. Greubel_, Dec 11 2019

%p a:= proc(n) local c, i, t; c, t:=1, 1;

%p for i to n-1 do t:= (t*i) mod n; c:= c+t od; c mod n

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Feb 16 2013

%t Table[Mod[Sum[ i!, {i, 0, n-1}], n], {n, 80}]

%t nn=80; With[{fcts=Accumulate[Range[0,nn]!]},Flatten[Table[Mod[Take[fcts,{n}], n], {n,nn}]]] (* _Harvey P. Dale_, Sep 22 2011 *)

%o (Haskell)

%o a049782 :: Int -> Integer

%o a049782 n = (sum $ take n a000142_list) `mod` (fromIntegral n)

%o -- _Reinhard Zumkeller_, Nov 02 2011

%o (PARI) a(n)=my(s=1,f=1); for(k=1,n, f=f*k%n; s+=f); s%n \\ _Charles R Greathouse IV_, Feb 07 2017

%o (Magma) [&+[Factorial(k-1): k in [1..n]] mod (n): n in [1..80]]; // _Vincenzo Librandi_, May 31 2019

%o (Sage) [mod(sum(factorial(k) for k in (0..n-1)), n) for n in (1..80)] # _G. C. Greubel_, Dec 11 2019

%o (GAP) List([1..80], n-> Sum([0..n-1], k-> Factorial(k)) mod n ); # _G. C. Greubel_, Dec 11 2019

%Y Cf. A000142, A057245.

%Y Note that in the context of this sequence, !n is the left factorial A003422 not the subfactorial A000166.

%K nonn,easy,nice

%O 1,4

%A _Clark Kimberling_

%E More terms from _Erich Friedman_, who observes that the first 500 terms are nonzero. Independently extended by _Stephen A. Silver_.