1 | initial version |
The issue is that the range
function outputs numbers of the type Python int
rather than Sage Integer
. You could use Sage's srange
function instead:
for i in range(2):
print(type(i))
will produce
<class 'int'>
<class 'int'>
whereas
for i in srange(2):
print(type(i))
will give
<class 'sage.rings.integer.Integer'>
<class 'sage.rings.integer.Integer'>
2 | No.2 Revision |
The issue is that the range
function outputs numbers of the type Python int
rather than Sage Integer
. , and digits
is only defined for the latter. You could use Sage's srange
function instead:
for i in range(2):
print(type(i))
will produce
<class 'int'>
<class 'int'>
whereas
for i in srange(2):
print(type(i))
will give
<class 'sage.rings.integer.Integer'>
<class 'sage.rings.integer.Integer'>