OFFSET
1,1
COMMENTS
The sum of the coefficients in the n-th cyclotomic polynomial is given by A020500.
The first occurrence of 4 in this sequence is a(330).
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
EXAMPLE
a(12)=2 because the distinct nonzero coefficients of the 12th cyclotomic polynomial, x^4 - x^2 + 1, are 1 and -1.
MAPLE
A230799 := n -> nops({coeffs(numtheory[cyclotomic](n, z), z)}):
seq(A230799(n), n=1..86); # Peter Luschny, Oct 30 2013
MATHEMATICA
a[n_] := List @@ Cyclotomic[n, x] /. x -> 1 // Union // Length;
Array[a, 100] (* Jean-François Alcover, Jul 08 2019 *)
PROG
(PARI) a(n) = v=vecsort(Vec(polcyclo(n)), , 8); if(has_zero(v), #v-1, #v)
has_zero(v) = for(i=1, #v, if(v[i]==0, return(1))); 0
(PARI) {a(n) = if( n<1, 0, #setminus( Set( Vec( polcyclo(n))), [0]))};
/* Michael Somos, Mar 27 2014 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Colin Barker, Oct 30 2013
STATUS
approved