ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 30 Oct 2014 15:48:18 +0100How to enter very large numbershttps://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/ Hi,
What is the best way to enter very large integers ( more than a thousand integers) on sage online? I tried to split the number into multiple lines using continuation symbols like \ and ... but nothing works. The horizontal scroll bar is not showing up when i enter the number on a single line. Thanks for your help.
Thu, 30 Oct 2014 15:42:42 +0100https://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/Comment by vdelecroix for <p>Hi,</p>
<p>What is the best way to enter very large integers ( more than a thousand integers) on sage online? I tried to split the number into multiple lines using continuation symbols like \ and ... but nothing works. The horizontal scroll bar is not showing up when i enter the number on a single line. Thanks for your help.</p>
https://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/?comment=24709#post-id-24709What do you mean by "sage online" ? Is that the cloud, the Sage notebook or something else ?Thu, 30 Oct 2014 15:44:47 +0100https://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/?comment=24709#post-id-24709Answer by vdelecroix for <p>Hi,</p>
<p>What is the best way to enter very large integers ( more than a thousand integers) on sage online? I tried to split the number into multiple lines using continuation symbols like \ and ... but nothing works. The horizontal scroll bar is not showing up when i enter the number on a single line. Thanks for your help.</p>
https://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/?answer=24710#post-id-24710Hello,
I would create a file that contains a number and then read it from Sage. To open a file this is a standard python command (see [Input and Output from python.org](https://docs.python.org/2/tutorial/inputoutput.html)):
sage: f = open("my_file_that_contains_a_big_number.txt")
sage: text = f.read()
sage: f.close()
sage: my_big_number = ZZ(text)
If it is multiple lines you can remove the breaks with
sage: f = open("my_file_that_contains_a_big_number.txt")
sage: text = f.read()
sage: f.close()
sage: text = text.replace("\n", "")
sage: text = text.replace("\r", "")
sage: text = text.replace(" ", "")
sage: my_big_number = ZZ(text)
VincentThu, 30 Oct 2014 15:48:18 +0100https://ask.sagemath.org/question/24708/how-to-enter-very-large-numbers/?answer=24710#post-id-24710