Cyclotomic polynomial: Difference between revisions

Content added Content deleted
Line 2,014: Line 2,014:


=={{header|J}}==
=={{header|J}}==

For values up to 70, we can find cyclotomic polynomials by finding a polynomial with roots of unity relatively prime to the order of the polynomial:

<lang J>cyclo=: {{<.-:1+(++) p. 1;^0j2p1* y%~1+I.1=y+.1+i.y}}</lang>

This approach suggests that cyclotomic polynomial zero should be <tt>f<sub>0(x)</sub>= 1</tt>


Implementation of routine to find nth cyclotomic polynomial:
Implementation of routine to find nth cyclotomic polynomial:


<lang J>{{ if.0>nc<'cache' do.cache=:y end.}} a:;_1 1
<lang J>{{ if.0>nc<'cache' do.cache=:y end.}} (,1);_1 1


cyclotomic=: {{
cyclotomic=: {{