| 1 | initial version |
You could use Python's list comprehension to make a list of the numbers you want:
sage: N = 5
sage: [(-1)^(n+1)*floor((n+1)/2) for n in range(N)]
[0, 1, -1, 2, -2]
sage: N = 6
sage: [(-1)^(n+1)*floor((n+1)/2) for n in range(N)]
[0, 1, -1, 2, -2, 3]
Is this the kind of thing you were looking for, or something else?
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.