William Stein wrote:
On Mon, Apr 5, 2010 at 12:39 PM, D.C. Ernst<[email protected]>  wrote:
Great, thanks!  This is the sort of thing I was trying, but I wasn't
handling the indentation correctly.  Perhaps y'all can help me with a
related issue.  I'd like my abstract algebra students to use Sage to
do some computations involving the group of units mod n.  I've been
fiddling around myself first.  Suppose I do the following in Sage:

U=Integers(40)
for j in range(1,16):
    for k in range(1,40):
        if gcd(k,40) == 1:
            print (U(k))^j

As expected, I get a really long list of values.  Is there a way to
chop this up in a way that would be palatable to my students?  I want
them to do some exploring of orders of elements and I know there are
commands that will just give them the answers I seek, but I want them
to be able to interpret the data.  Any suggestions?

Making

            print (U(k))^j

into

             print (U(k)^j),     # note the comma.

might help.
This does help.  BTW, above, I meant to write (swap order of k and j):

for k in range(1,40):
    for j in range(16):
        if gcd(k,40) == 1:
            print (U(k))^j

Is there a way to insert a character after each (U(k))^16, so that it is obvious where the loop (correct terminology?) starts over? Also, feel free to offer a different approach to this altogether.

Dana

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe, reply using "remove me" as the subject.

Reply via email to