%I #28 Sep 28 2023 10:16:11
%S 0,0,1,0,1,0,1,1,1,0,2,1,1,1,2,1,2,0,2,2,2,0,3,2,1,2,3,1,3,0,3,3,1,1,
%T 4,3,1,1,3,2,3,1,2,3,2,0,4,5,2,2,2,1,3,3,3,3,1,0,5,4,1,2,4,4,3,1,2,2,
%U 3,1,5,6,1,2,3,2,3,1,4,6,2,0,5,5,1,1,3
%N Number of monic cubic polynomials with coefficients from {1..n} and maximum coefficient equal to n, for which all three roots are integers.
%H Zak Seidov, <a href="/A238097/b238097.txt">Table of n, a(n) for n = 1..1000</a>
%H Dorin Andrica and Eugen J. Ionascu, <a href="http://www.emis.de/journals/ASUO/mathematics_/vol22-1/Andrica_D__Ionascu_E.J._nou-1__final_.pdf">On the number of polynomials with coefficients in [n]</a>, An. St. Univ. Ovidius Constanta, Vol. 22(1),2014, 13-23.
%e a(11) = 2 with polynomials x^3 + 6*x^2 + 11*x + 6 = (x+1) * (x+2) * (x+3) and x^3 + 7*x^2 + 11*x + 5 = (x+1)^2 * (x+5). - _Michael Somos_, Feb 23 2014
%t Table[p = Flatten[Table[{a, b, c, 1}, {a, n}, {b, n}, {c, n}], 2]; cnt = 0; Do[If[Max[p[[i]]] == n, poly = p[[i]].x^Range[0, 3]; r = Rest[FactorList[poly]]; If[Total[Transpose[r][[2]]] == 3 && Union[Coefficient[Transpose[r][[1]], x]] == {1}, Print[{n, r}]; cnt++]], {i, Length[p]}]; cnt, {n, 20}] (* _T. D. Noe_, Feb 22 2014 *)
%o (PARI) {a(n) = if( n<1, 0, sum(a1=1, n, sum(a2=1, n, sum(a3=1, n, vecmax([a1, a2, a3]) == n && vecsum( factor( Pol([1, a1, a2, a3]))[, 2]) == 3))))}; /* _Michael Somos_, Feb 23 2014 */
%Y Cf. A006218, A066955, A238096, A238098.
%K nonn
%O 1,11
%A _N. J. A. Sloane_, Feb 22 2014
%E Definition corrected by _Giovanni Resta_, Feb 22 2014
%E Extended by _T. D. Noe_, Feb 22 2014