cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A282692 a(n) = maximal number of nonzero real roots of any of the 3^(n+1) polynomials c_0 + c_1*x + c_2*x^2 + ... + c_n*x^n where the coefficients c_i are -1, 0, or 1.

Original entry on oeis.org

0, 1, 2, 3, 3, 3, 4, 5, 5, 5, 5, 5, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8
Offset: 0

Views

Author

Oanh Nguyen and N. J. A. Sloane, Feb 23 2017

Keywords

Comments

The roots are counted with multiplicity.
Comments from Chai Wah Wu, Feb 23 2017: (Start)
1. a(n+1) >= a(n) since p(x)*x has the same number of nonzero real roots as p(x).
2. If we define a sequence b(n) by requiring the highest coefficient to be nonzero, that is, if we let b(n) = maximal number of nonzero real roots of any of the polynomials c_0 + c_1*x + c_2*x^2 + ... + c_n*x^n where the coefficients c_i are -1, 0, or 1, and c_n != 0, then Comment 1 shows that we get nothing new, and b(n) = a(n).
(End)
From the reasoning in Chai Wah Wu's comment 1, this is also the maximal number of real roots of any of the polynomials c_0 + c_1*x + c_2*x^2 + ... + c_n*x^n where the coefficients c_i are -1, 0, or 1, and c_0 != 0. A new sequence b(n) is created (A282701) if both c_0 and c_n are != 0. - Peter Munn, Feb 25 2017

Examples

			a(1) = 1 from 1-x.
a(2) = 2 from 1+x-x^2.
a(3) = 3 from 1-x-x^2+x^3 = (1-x)*(1-x^2).
a(5) = 3 from x^5-x^4+x^3-x^2-x+1. - _Robert Israel_, Feb 26 2017
a(7) = 5 from x^7 + x^6 - x^5 - x^4 - x^3 - x^2 + x + 1 = (x - 1)^2*(x + 1)^3*(x^2 + 1). - _Chai Wah Wu_ and _W. Edwin Clark_, Feb 23 2017
a(8) = 5 from the same polynomial. - _Chai Wah Wu_, Feb 23 2017
a(13) = a(14) = 7 from x^13 + x^12 - x^11 - x^10 - x^9 - x^8 + x^5 + x^4 + x^3 + x^2 - x - 1 = (x - 1)^3*(x + 1)^4*(x^2 + 1)*(x^2 - x + 1)*(x^2 + x + 1). - _Chai Wah Wu_, Feb 24 2017
		

Crossrefs

Formula

a(n) = max { A282701(k) : k=0..n }. - Max Alekseyev, Jan 27 2022

Extensions

a(7) corrected by Chai Wah Wu and W. Edwin Clark, Feb 23 2017
a(8) corrected by Chai Wah Wu, Feb 23 2017
a(13)-a(14) corrected by Chai Wah Wu, Feb 24 2017
a(15)-a(21) from Max Alekseyev, Jan 28 2022

A282691 a(n) = maximal number of real roots of any of the 2^(n+1) polynomials c_0 + c_1*x + c_2*x^2 + ... + c_n*x^n where the coefficients c_i are +1 or -1.

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 2, 5, 4, 5, 4, 5, 4, 5, 6, 7, 6, 5, 6, 7, 6, 7, 6, 9, 6, 7, 8, 9, 8, 9, 8
Offset: 0

Views

Author

Oanh Nguyen and N. J. A. Sloane, Feb 23 2017

Keywords

Comments

The roots are counted with multiplicity.
Since (+/-)P((+/-)x) has the same number of real roots as P(x), we need consider only the cases where the x^0 and x^1 coefficients are +1. - Robert Israel, Feb 23 2017

Examples

			a(1) = 1 from 1 + x.
a(2) = 2 from 1 + x - x^2.
a(3) = 3 from 1 + x - x^2 - x^3 = (1+x)*(1-x^2).
a(5) = 3 from x^5 - x^4 + x^3 - x^2 - x + 1. - _Robert Israel_, Feb 26 2017
a(7) = 5 from x^7 + x^6 - x^5 - x^4 - x^3 - x^2 + x + 1 = (x - 1)^2*(x + 1)^3*(x^2 + 1). - _Chai Wah Wu_ and _W. Edwin Clark_, Feb 23 2017
		

Crossrefs

Programs

  • Maple
    # Maple program using Robert Israel's suggestion (above) for the computation of a(n) using Sturm's Theorem and the squarefree factorization of the 1,-1 polynomials, from W. Edwin Clark, Feb 23 2017:
    numroots:=proc(p,x)
    local s:
    sturm(sturmseq(p,x),x,-infinity,infinity):
    end proc:
    a:=proc(n)
    local m,T,L,L1,p,P,s,k,q,u;
    m:=0;
    T:=combinat:-cartprod([seq([1,-1],i=1..n-1)]):
    while not T[finished] do
      L:=T[nextvalue]();
      L1:=[1,1,op(L)];
      p:=add(L1[i]*x^(i-1),i=1..n+1);
      q:=sqrfree(p,x);
      k:=0;
      for u in q[2] do k:=k+numroots(u[1],x)*u[2]; od;
      if k > m then m:=k;  fi;
    end do:
    return m;
    end proc:
  • Mathematica
    Do[Print[Max[CountRoots[Internal`FromCoefficientList[#, x], x] & /@  Tuples[{1, -1}, n]]], {n, 1, 23}] (* Luca Petrone, Feb 23 2017 *)
  • Sage
    import itertools
    def a(n):
        if n==0: return 0
        R = ZZ['x']; ans = 0
        for c in itertools.product([-1,1], repeat=(n-1)):
            p = R([1,1]+list(c))
            num_roots = sum([f[0].number_of_real_roots()*f[1] for f in p.factor()])
            ans = max(ans, num_roots)
        return ans  # Robin Visser, Sep 02 2024

Extensions

a(7) corrected and a(15)-a(16) added by Chai Wah Wu, Feb 23 2017; a(7) also corrected by W. Edwin Clark, Feb 23 2017
a(17)-a(22) added by Luca Petrone, Feb 23 2017
a(23) added by W. Edwin Clark, Feb 24 2017
a(24)-a(30) from Robin Visser, Sep 02 2024
Showing 1-2 of 2 results.