%I #28 Dec 23 2018 09:45:31
%S 4,1,165,595,1785,1785,2805,3135,6545,6545,10465,10465,10465,10465,
%T 10465,11305,11305,11305,11305,11305,11305,11305,15015,11305,20615,
%U 17255,20615,20615,26565,26565,26565,26565,26565,26565,26565,26565,26565,26565,26565,26565,26565
%N Least k such that the k-th cyclotomic polynomial has n as a coefficient.
%C Suzuki proves that a(n) exists for each n. Vaughan proves that there are infinitely many k with a(n) = k and n > exp(exp(log 2 * log k/log log k)).
%H Robert Israel, <a href="/A262404/b262404.txt">Table of n, a(n) for n = 0..1000</a>
%H Jiro Suzuki, <a href="http://projecteuclid.org/euclid.pja/1195513653">On coefficients of cyclotomic polynomials</a>, Proc. Japan Acad. Ser. A Math. Sci. 63:7 (1987), pp. 279-280.
%H R. C. Vaughan, <a href="http://projecteuclid.org/euclid.mmj/1029001352">Bounds for the coefficients of cyclotomic polynomials</a>, Michigan Math. J. 21 (1974), 289-295 (1975).
%e Phi(165) = x^80 + x^79 + x^78 - x^75 - x^74 - x^73 - x^69 - x^68 - x^67 + x^65 + 2x^64 + 2x^63 + x^62 - x^60 - x^59 - x^58 - x^54 - x^53 - x^52 + x^50 + 2x^49 + 2x^48 + 2x^47 + x^46 - x^44 - x^43 - x^42 - x^41 - x^40 - x^39 - x^38 - x^37 - x^36 + x^34 + 2x^33 + 2x^32 + 2x^31 + x^30 - x^28 - x^27 - x^26 - x^22 - x^21 - x^20 + x^18 + 2x^17 + 2x^16 + x^15 - x^13 - x^12 - x^11 - x^7 - x^6 - x^5 + x^2 + x + 1, with 2 as the coefficient of x^16 (among others), and this is the least k for which 2 appears, so a(2) = 165.
%p N:= 40: count:= 0: A:= Array(0..N): A[0]:= 4:
%p for k from 1 while count < N do
%p S:= select(t -> t::posint and t <= N and A[t] = 0, {coeffs(numtheory:-cyclotomic(k,x),x)}):
%p if S <> {} then
%p A[convert(S,list)]:= k;
%p count:= count + nops(S);
%p fi
%p od:
%p convert(A,list); # _Robert Israel_, Dec 23 2018
%t Table[k = 1; While[! MemberQ[CoefficientList[Cyclotomic[k, x], x], n], k++]; k, {n, 0, 9}] (* _Michael De Vlieger_, Sep 29 2015 *)
%o (PARI) a(n)=my(k,v);while(!setsearch(Set(Vec(polcyclo(k++))),n),);k
%Y Cf. A013594, A013595, A046887, A262405, A160340, A278567.
%K nonn,look
%O 0,1
%A _Charles R Greathouse IV_, Sep 21 2015
%E Corrected a(22); more terms from _Seiichi Manyama_, Dec 22 2018