login
Smallest m such that 0!+1!+...+(m-1)! is divisible by n, or 0 if no such m exists.
4

%I #18 Apr 13 2019 14:16:35

%S 1,2,0,3,4,0,6,0,0,4,6,0,0,6,0,0,5,0,7,0,0,6,7,0,0,0,0,0,0,0,12,0,0,5,

%T 0,0,22,7,0,0,16,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,12,0,0,0,0,

%U 0,0,0,0,54,0,42,22,0,0,6,0,0,0,0,16,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0

%N Smallest m such that 0!+1!+...+(m-1)! is divisible by n, or 0 if no such m exists.

%C From _Robert Israel_, Nov 14 2016: (Start)

%C a(n) < n for n > 2.

%C If a(n) = 0, then a(mn) = 0 for all m>=2. (End)

%D M. R. Mudge, Smarandache Notions Journal, University of Craiova, Vol. VII, No. 1, 1996.

%H Robert Israel, <a href="/A013584/b013584.txt">Table of n, a(n) for n = 1..10000</a>

%p f:= proc(n) local t,r,m;

%p r:= 1; t:= 1;

%p for m from 1 do

%p r:= r*m mod n;

%p if r = 0 then return 0 fi;

%p t:= t + r mod n;

%p if t = 0 then return m+1 fi;

%p od;

%p end proc:

%p f(1):= 1:

%p map(f, [$1..100]); # _Robert Israel_, Nov 14 2016

%t a[n_] := Module[{t, r, m}, r = 1; t = 1; For[m = 1, True, m++, r = Mod[r*m, n]; If[r == 0, Return[0]]; t = Mod[t+r, n]; If[t == 0, Return[m+1]]]];

%t Array[a, 100] (* _Jean-François Alcover_, Apr 12 2019, after _Robert Israel_ *)

%Y Cf. A003422, A013585, A049044, A049045, A275608.

%K nonn

%O 1,2

%A Michael R. Mudge (Amsorg(AT)aol.com)