login
a(n) = smallest k such that all of 1 through n divides k!.
1

%I #10 Apr 01 2024 12:14:58

%S 1,2,3,4,5,5,7,7,7,7,11,11,13,13,13,13,17,17,19,19,19,19,23,23,23,23,

%T 23,23,29,29,31,31,31,31,31,31,37,37,37,37,41,41,43,43,43,43,47,47,47,

%U 47,47,47,53,53,53,53,53,53,59,59

%N a(n) = smallest k such that all of 1 through n divides k!.

%C It is conjectured that after n=4 the sequence is prime for n prime or the previous prime for n not prime.

%e a(6)=5 as 5!=120 which is divisible by 1,2,3,4,5 and 6.

%p A094802 := proc(n)

%p local k,nlcm ;

%p nlcm := A003418(n) ;

%p for k from 1 do

%p if modp(k!,nlcm) = 0 then

%p return k ;

%p end if;

%p end do:

%p end proc:

%p seq(A094802(n),n=1..30) ; # _R. J. Mathar_, Nov 15 2019

%t a[n_] := Module[{k = 1}, While[True, If[AllTrue[Range[n], Divisible[k!, #]&], Return[k]]; k++]];

%t Table[a[n], {n, 1, 60}] (* _Jean-François Alcover_, Apr 01 2024 *)

%o (PARI) { for (i=1,60,x=1; for (j=1,i,xf=x!; if (xf%j!=0,x+=1;j=1)); print1(","x)) }

%Y Cf. A002034, A007917.

%K nonn

%O 1,2

%A _Jon Perry_, Jun 11 2004

%E Corrected by _T. D. Noe_, Nov 02 2006