%I #24 Mar 01 2016 12:30:18
%S 2,2,2,2,2,2,4,4,3,2,2,2,2,2,9,8,3,6,2,2,2,2,36,36,20,18,36,2,2,2,16,
%T 16,2,2,3,12,2,2,4,4,2,2,2,4,3,2,16,896,175,10,2,2,9,9,4,4,2,2,2,2,2,
%U 256,417,32,2,2,2,2,2,2,4,36,2,5,5,2,2,2,81,136,135,2
%N Least number k > 1 such that C(n+k,n) is squarefree.
%C By theorem 6 of the Granville-Ramaré link, a(n) exists for all n. - _Robert Israel_, Mar 01 2016
%H Robert Israel, <a href="/A268045/b268045.txt">Table of n, a(n) for n = 0..477</a>
%H A. Granville and O. Ramaré, <a href="http://dx.doi.org/10.1112/S0025579300011608">Explicit bounds on exponential sums and the scarcity of squarefree binomial coefficients</a>, Mathematika 43 (1996) 73-107.
%p F:= proc(n)
%p local F,k;
%p if numtheory:-issqrfree((n+2)*(n+1)/2) then return 2 fi;
%p F:= ifactor((n+2)*(n+1)/2);
%p for k from 3 do
%p F:= F * ifactor(n+k)/ifactor(k);
%p if not hastype(F,`^`) then return k fi
%p od:
%p end proc:
%p map(F, [$0..100]); # _Robert Israel_, Jan 26 2016
%t Table[k = 2; While[! SquareFreeQ@ Binomial[n + k, n], k++]; k, {n, 0, 81}] (* _Michael De Vlieger_, Jan 27 2016 *)
%o (PARI) findk(n) = {my(k=2); while (! issquarefree(binomial(n+k, n)), k++); k;} \\ _Michel Marcus_, Jan 26 2016
%o (PARI) b(n,p)=my(s);while(n\=p,s+=n);s
%o ok(n,k)=forprime(p=2,sqrtint(n+k),if(b(n+k,p)-b(k,p)-b(n,p)>1, return(0))); 1
%o a(n)=my(k=1); while(!ok(n,k++), ); k \\ _Charles R Greathouse IV_, Feb 18 2016
%o (Python)
%o from __future__ import division
%o from collections import Counter
%o from sympy import factorint
%o def A268045(n):
%o if n == 0:
%o return 2
%o flist, k = Counter(factorint((n+2)*(n+1)//2)), 2
%o while max(flist.values()) >= 2:
%o k += 1
%o flist += Counter(factorint(n+k))
%o flist -= Counter(factorint(k))
%o return k # _Chai Wah Wu_, Feb 17 2016
%K nonn
%O 0,1
%A _Gionata Neri_, Jan 25 2016