%I #44 Mar 30 2024 06:34:35
%S 1,2,7,10,19,28
%N a(n) is the smallest degree of (0,1)-polynomial with exactly n real distinct roots.
%C (0,1) (or Newman) polynomials have coefficients from {0,1}.
%H P. Borwein, T. Erdélyi, and G. Kós, <a href="https://doi.org/10.1112/S0024611599011831">Littlewood-type problems on [0,1]</a>, Proc. London Math. Soc. 79 (1999), 22-46.
%H MathOverflow, <a href="https://mathoverflow.net/questions/461631/number-of-real-roots-of-0-1-polynomial">Number of real roots of 0,1 polynomial</a>.
%H A. Odlyzko and B. Poonen, <a href="https://doi.org/10.5169/seals-60430">Zeros of polynomials with 0,1 coefficients</a>, L’Enseignement Mathématique 39 (1993), 317-348.
%F a(n) ~ C*n^2 (see Odlyzko and Poonen) with numerical estimate 0.7 < C < 0.9.
%t (* Suitable only for 1 <= n <= 4;
%t for larger n, special Julia and Python packages are needed *)
%t Table[Exponent[Monitor[Catch[Do[
%t poly = FromDigits[IntegerDigits[k, 2], x];
%t res = Length@{ToRules@Reduce[poly == 0, x, Reals]};
%t If[res == n, Throw@{res, Expand@poly}]
%t , {k, 2000}]], k][[2]], x], {n, 1, 4}]
%o (Python)
%o from itertools import count
%o from sympy.abc import x
%o from sympy import sturm, oo, sign, nan, LT
%o def A368824(n):
%o for m in count(2):
%o l = len(s:=bin(m)[2:])
%o q = sturm(sum(int(s[i])*x**(l-i-1) for i in range(l)))
%o a = [1 if (k:=LT(p).subs(x,-oo))==nan else sign(k) for p in q[:-1]]+[sign(q[-1])]
%o b = [1 if (k:=LT(p).subs(x,oo))==nan else sign(k) for p in q[:-1]]+[sign(q[-1])]
%o if n==sum(1 for i in range(len(a)-1) if a[i]!=a[i+1])-sum(1 for i in range(len(b)-1) if b[i]!=b[i+1]):
%o return l-1 # _Chai Wah Wu_, Feb 15 2024
%Y Cf. A368774, A362344.
%K nonn,hard,more
%O 1,2
%A _Denis Ivanov_, Jan 07 2024