Ask Your Question

# polynomial

asked 2016-10-09 20:05:29 +0200 This post is a wiki. Anyone with karma >750 is welcome to improve it.

.

p=5
f1=(p^2-1)
f2=divisors(f1)
f2
for  i in f2 :
f=cyclotomic_polynomial(i,'z')
print (i,f)


Result:

[1, 2, 3, 4, 6, 8, 12, 24]
(1, z - 1)
(2, z + 1)
(3, z^2 + z + 1)
(4, z^2 + 1)
(6, z^2 - z + 1)
(8, z^4 + 1)
(12, z^4 - z^2 + 1)
(24, z^8 - z^4 + 1)


i want the above result in the following form

phi1= z - 1
phi2= z + 1
phi3= z^2 + z + 1
phi4= z^2 + 1
phi6= z^2 - z + 1
phi8= z^4 + 1
phi12= z^4 - z^2 + 1
phi24= z^8 - z^4 + 1


how to obtained.

edit retag close merge delete

## Comments

To display inline code, surround it within backticks .

To display blocks of code, either indent them with 4 spaces, or select the corresponding lines and click the "code" button (the icon with '101 010').

Can you edit your question to do that?

## 1 Answer

Sort by » oldest newest most voted Changing the print statement to print "phi{0} = {1}".format(i,f)` should do the job.

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2016-10-09 20:05:29 +0200

Seen: 219 times

Last updated: Oct 19 '16