On Apr 5, 10:05 pm, Mike Hansen <[email protected]> wrote:
> This uses a few more constructs...

based on your example, here is one that aligns the numbers visually.
"%2d" means to format the number as a number that always takes two
characters.

U = Integers(40)
for k in U:
    if gcd(k,40) != 1:
        continue
    else:
        print "%2d:" % k,
    for j in range(16):
        print "%2d" % k^j,
    print


 1:  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
 3:  1  3  9 27  1  3  9 27  1  3  9 27  1  3  9 27
 7:  1  7  9 23  1  7  9 23  1  7  9 23  1  7  9 23
 9:  1  9  1  9  1  9  1  9  1  9  1  9  1  9  1  9
11:  1 11  1 11  1 11  1 11  1 11  1 11  1 11  1 11
13:  1 13  9 37  1 13  9 37  1 13  9 37  1 13  9 37
17:  1 17  9 33  1 17  9 33  1 17  9 33  1 17  9 33
19:  1 19  1 19  1 19  1 19  1 19  1 19  1 19  1 19
21:  1 21  1 21  1 21  1 21  1 21  1 21  1 21  1 21
23:  1 23  9  7  1 23  9  7  1 23  9  7  1 23  9  7
27:  1 27  9  3  1 27  9  3  1 27  9  3  1 27  9  3
29:  1 29  1 29  1 29  1 29  1 29  1 29  1 29  1 29
31:  1 31  1 31  1 31  1 31  1 31  1 31  1 31  1 31
33:  1 33  9 17  1 33  9 17  1 33  9 17  1 33  9 17
37:  1 37  9 13  1 37  9 13  1 37  9 13  1 37  9 13
39:  1 39  1 39  1 39  1 39  1 39  1 39  1 39  1 39

you can also format it as an html table, read the output of
html.table? for more information ;)

h

-- 
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

Reply via email to