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.

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

This page as a plain text file.
%I A013584 #18 Apr 13 2019 14:16:35
%S A013584 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 A013584 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 A013584 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 A013584 Smallest m such that 0!+1!+...+(m-1)! is divisible by n, or 0 if no such m exists.
%C A013584 From _Robert Israel_, Nov 14 2016: (Start)
%C A013584 a(n) < n for n > 2.
%C A013584 If a(n) = 0, then a(mn) = 0 for all m>=2. (End)
%D A013584 M. R. Mudge, Smarandache Notions Journal, University of Craiova, Vol. VII, No. 1, 1996.
%H A013584 Robert Israel, <a href="/A013584/b013584.txt">Table of n, a(n) for n = 1..10000</a>
%p A013584 f:= proc(n) local t,r,m;
%p A013584   r:= 1; t:= 1;
%p A013584   for m from 1 do
%p A013584     r:= r*m mod n;
%p A013584     if r = 0 then return 0 fi;
%p A013584     t:= t + r mod n;
%p A013584     if t = 0 then return m+1 fi;
%p A013584   od;
%p A013584 end proc:
%p A013584 f(1):= 1:
%p A013584 map(f, [$1..100]); # _Robert Israel_, Nov 14 2016
%t A013584 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 A013584 Array[a, 100] (* _Jean-François Alcover_, Apr 12 2019, after _Robert Israel_ *)
%Y A013584 Cf. A003422, A013585, A049044, A049045, A275608.
%K A013584 nonn
%O A013584 1,2
%A A013584 Michael R. Mudge (Amsorg(AT)aol.com)