Cyclotomic polynomial: Difference between revisions
Content added Content deleted
m (Removed a useless variable.) |
(+Maple) |
||
Line 3,022: | Line 3,022: | ||
CP[6545] has coefficient with magnitude = 9 |
CP[6545] has coefficient with magnitude = 9 |
||
CP[10465] has coefficient with magnitude = 10</pre> |
CP[10465] has coefficient with magnitude = 10</pre> |
||
=={{header|Maple}}== |
|||
<lang maple>with(NumberTheory): |
|||
for n to 30 do lprint(Phi(n,x)) od: |
|||
x-1 |
|||
x+1 |
|||
x^2+x+1 |
|||
x^2+1 |
|||
x^4+x^3+x^2+x+1 |
|||
x^2-x+1 |
|||
x^6+x^5+x^4+x^3+x^2+x+1 |
|||
x^4+1 |
|||
x^6+x^3+1 |
|||
x^4-x^3+x^2-x+1 |
|||
x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 |
|||
x^4-x^2+1 |
|||
x^12+x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 |
|||
x^6-x^5+x^4-x^3+x^2-x+1 |
|||
x^8-x^7+x^5-x^4+x^3-x+1 |
|||
x^8+1 |
|||
x^16+x^15+x^14+x^13+x^12+x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 |
|||
x^6-x^3+1 |
|||
x^18+x^17+x^16+x^15+x^14+x^13+x^12+x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+ |
|||
1 |
|||
x^8-x^6+x^4-x^2+1 |
|||
x^12-x^11+x^9-x^8+x^6-x^4+x^3-x+1 |
|||
x^10-x^9+x^8-x^7+x^6-x^5+x^4-x^3+x^2-x+1 |
|||
x^22+x^21+x^20+x^19+x^18+x^17+x^16+x^15+x^14+x^13+x^12+x^11+x^10+x^9+x^8+x^7+x^ |
|||
6+x^5+x^4+x^3+x^2+x+1 |
|||
x^8-x^4+1 |
|||
x^20+x^15+x^10+x^5+1 |
|||
x^12-x^11+x^10-x^9+x^8-x^7+x^6-x^5+x^4-x^3+x^2-x+1 |
|||
x^18+x^9+1 |
|||
x^12-x^10+x^8-x^6+x^4-x^2+1 |
|||
x^28+x^27+x^26+x^25+x^24+x^23+x^22+x^21+x^20+x^19+x^18+x^17+x^16+x^15+x^14+x^13 |
|||
+x^12+x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1 |
|||
x^8+x^7-x^5-x^4-x^3+x+1 |
|||
PhiWithN:=proc(n) |
|||
local k,c,s; |
|||
for k from 1 do |
|||
s:={coeffs(Phi(k,x),x)}; |
|||
if member(n,s) or member(-n,s) then return(k) fi |
|||
od |
|||
end: |
|||
[seq(PhiWithN(n),n=1..10)]; |
|||
# [1, 105, 385, 1365, 1785, 2805, 3135, 6545, 6545, 10465]</lang> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |