login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Least value of k such that n!/((n-k)!)^2 is an integer.
2

%I #10 Jun 28 2018 02:50:13

%S 1,1,2,2,3,3,4,4,5,4,5,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,13,14,

%T 15,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,

%U 27,26,27,28,29,29,30,30,31,31,32,32,33,33,34,34,35,35,36,36,37,37,38

%N Least value of k such that n!/((n-k)!)^2 is an integer.

%C If p is the first prime > n/2, then a(n) > n-p. - _Robert Israel_, Jun 27 2018

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

%e a(10) = 4.

%p f:= proc(n) local p,k;

%p p:= nextprime(floor(n/2));

%p for k from n-p+1 do

%p if (n!/((n-k)!)^2)::integer then return k fi

%p od

%p end proc:

%p f(1):= 1:

%p map(f, [$1..100]); # _Robert Israel_, Jun 27 2018

%t f[n_] := Block[{i = 1, t = Table[n!/(n - k)!^2, {k, n}]}, While[ !IntegerQ[ t[[i]]], i++ ]; i]; Table[ f[n], {n, 75}] (* _Robert G. Wilson v_, Jul 03 2004 *)

%Y Cf. A096123, A096124.

%K nonn

%O 1,3

%A _Amarnath Murthy_, Jul 01 2004

%E Edited, corrected and extended by _Robert G. Wilson v_, Jul 03 2004