# Idempotent help

Hello my fellow Sage users. I'm trying to come up ith a formula in sage that relates the number of idempotents in Zn with the number of distinct prime factors that n has. Talking about idempotent rings in my class has gotten a few students confused and this formula will help me better explain the concept. Thank you. Any pointers in the right direction would help greatly.

edit retag close merge delete

Sort by » oldest newest most voted

Here is some code for this:

for n in [2..100]:
print n,': (',len(n.prime_factors()), sum(a.is_idempotent() for a in Zmod(n)),')'


For a fixed n, len(n.prime_factors()) gives the number of prime factors of n and sum(a.is_idempotent() for a in Zmod(n)) gives the number of idempotents.

more

I guess the number of idempotents should be basically the same as the number of direct summands -- is that right? If so, then maybe you're looking for the direct-sum decomposition of Z/n. Does the fundamental theorem of finitely generated abelian groups give you enough information?

more