login
Smallest k such that n+k divides (k+1)!-k!.
0

%I #12 Aug 02 2024 11:35:58

%S 5,2,3,4,5,3,5,4,6,5,7,4,7,6,3,8,7,6,5,4,6,8,7,6,5,6,8,4,7,6,9,8,7,6,

%T 5,9,8,7,6,8,7,6,11,4,5,10,9,6,7,10,9,8,7,6,5,7,13,12,11,10,9,8,7,8,7,

%U 6,13,12,11,5,9,8,7,6,9,8,7,12,11,10,9,8,7,6,11,10,9,8,11,6,7,4,12,11,5

%N Smallest k such that n+k divides (k+1)!-k!.

%t a[n_]:=Module[{k=1},While[!Divisible[(k+1)!-k!,n+k], k++]; k]; Array[a,95] (* _Stefano Spezia_, Aug 02 2024 *)

%o (PARI) a(n) = {k = 1; while (((k+1)! - k!) % (n+k), k++); k;} \\ _Michel Marcus_, Nov 26 2013

%Y Cf. A001563.

%K easy,nonn

%O 1,1

%A _Benoit Cloitre_, May 30 2002