Ask Your Question

Revision history [back]

If you want to make B an integer, as in your previous question, you can first try:

sage: ZZ(str(B))
262145

which looks retty weird. Thi is due to the fact that the number:

sage: str(B)
'01000001'

starts with a 0, indicating that it should undertand the representation to be in octal, while you want it in binary. Fortunately, you can specify the base in the conversion:

sage: b = ZZ(str(B), base=2) ; b 65 sage: b.parent() Integer Ring

If you want to make B an integer, as in your previous question, you can first try:

sage: ZZ(str(B))
262145

which looks retty pretty weird. Thi This is due to the fact that the number:

sage: str(B)
'01000001'

starts with a 0, indicating that it should undertand the representation to be in octal, while you want it in binary. Fortunately, you can specify the base in the conversion:

sage: b = ZZ(str(B), base=2) ; b 65 sage: b.parent() Integer Ring

If you want to make B an integer, as in your previous question, you can first try:

sage: ZZ(str(B))
262145

which looks pretty weird. This is due to the fact that the number:

sage: str(B)
'01000001'

starts with a 0, indicating that it should undertand the representation to be in octal, while you want it in binary. Fortunately, you can specify the base in the conversion:

sage: b = ZZ(str(B), base=2) ; b
65
sage: b.parent()
Integer Ring

Ring

If Let me just add a warning: if you want to make B an integer, as in your previous question, you can first try:

sage: ZZ(str(B))
262145

which looks pretty weird. This is due to the fact that the number:

sage: str(B)
'01000001'

starts with a 0, indicating that it should undertand the representation to be in octal, while you want it in binary. Fortunately, you can specify the base in the conversion:

sage: b = ZZ(str(B), base=2) ; b
65
sage: b.parent()
Integer Ring