ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 12 Dec 2010 08:24:09 -0600Idempotent helphttp://ask.sagemath.org/question/7745/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.Thu, 09 Dec 2010 13:56:12 -0600http://ask.sagemath.org/question/7745/idempotent-help/Answer by Jason Bandlow for <p>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.</p>
http://ask.sagemath.org/question/7745/idempotent-help/?answer=11854#post-id-11854Here 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.
Sun, 12 Dec 2010 08:24:09 -0600http://ask.sagemath.org/question/7745/idempotent-help/?answer=11854#post-id-11854Answer by niles for <p>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.</p>
http://ask.sagemath.org/question/7745/idempotent-help/?answer=11830#post-id-11830I 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](http://en.wikipedia.org/wiki/Finitely_generated_abelian_group#Classification) give you enough information?Fri, 10 Dec 2010 15:25:43 -0600http://ask.sagemath.org/question/7745/idempotent-help/?answer=11830#post-id-11830