OFFSET
1,1
COMMENTS
Conjecture: every number occurs in this sequence. This is based on the fact that every integer is a coefficient in the expansion of a cyclotomic polynomial. See Chun-Gang Ji and Wei-Ping Li link below.
First occurrence of k, for k>=0: 2, 4, 1, 105, 330, 385, 770, 1365, 1995, 1785, 3570, 5610, 2805, 6279, 3135, 14245, ..., see A345080.
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10000
Chun-Gang Ji and Wei-Ping Li, Values of coefficients of cyclotomic polynomials, Discrete Mathematics, Vol. 308, No. 23 (2008), 5860-5863.
Emma Lehmer, On the magnitude of the coefficients of the cyclotomic polynomial, Bull. Amer. Math. Soc. 42 (1936), 389-392.
Eric Weisstein's World of Mathematics, Cyclotomic Polynomial.
Wikipedia, Cyclotomic Polynomial.
FORMULA
a(n) = 0 if and only if n is prime.
a(n) = 1 if and only if n = p^e with prime p, e >= 2 (A246547). The "if" part is obvious. For the converse, note that Phi_n(1) = 1 if and only if n is not a prime power (A246655). If n is not a prime power and Phi_n has only nonnegative coefficients, then Phi_n(1) = 1 implies that Phi_n is a monomial, which is impossible.
EXAMPLE
a(1) = 2. The expansion of the 1st cyclotomic polynomial, Phi_1(x) = x - 1; the difference between 1 and -1 is 2;
a(2) = 0. The expansion of the 2nd cyclotomic polynomial, Phi_2(x) = x + 1; the difference between 1 and 1 is 0;
a(105) = 3. The expansion of the 105th cyclotomic polynomial, Phi_105(x) = x^48 + x^47 + ... - x^8 - 2x^7 - x^6 + ... + 1; the difference between 1 and -2 is 3; etc.
MATHEMATICA
a[n_] := Block[{b = Union[ CoefficientList[ Cyclotomic[n, x], x]]}, b[[-1]] - b[[1]]]; Array[a, 105]
PROG
(PARI) A345079(n) = my(v=Vec(polcyclo(n))); vecmax(v) - vecmin(v)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song and Robert G. Wilson v, Jun 04 2021
STATUS
approved