Is This A limitation of my Processing Power
I'm trying to load a large number into Sage for factoring. I believe with the help of the people on this forum I've managed to create the string and read the number back into a string:
Create the String
foo=str(frac(pi).n(digits=13048009))
f=open(r"/mnt/c/Users/karen/Desktop/factcipher.txt", "w", encoding="utf8")
f.write("%s\n"%foo[2:])
Read Number Back into a String
Sage: f=open(r"/mnt/c/Users/karen/Desktop/factcipher.txt", "r", encoding="utf8")
Sage: bar=f.readline()
Sage: f.close()
I'm now trying to convert it to an integer:
Sage: gee=eval("Integer(%s)"%bar)
but it just hangs. Is this a limitation of my laptop. I know for a fact other people have managed to read the number into Sage and factor it, though I don't know their exact process
Does it work if your file instead contains a smaller integer, say 5 digits?
You should add
f.close()
after writing to the file; otherwise, thewrite
operation may not complete.ISTR that I gave you this example, and that my read test ran in about 45 seconds on a fast AMD Ryzen 9 with gobs of memory (but no noticeable RAM consumption nor CPU abuse : this example used one CPU at a time). On a slow machine (and especially on Windows, where Sage runs in a virtual machine), you should give it a few minutes before throwing the towel.
I can't test this on
When I'll be able to access my machine, I'll check that and correct the present comment if necessary.
Check inSagecell : readind an integer of 200 000 digits takes about half a second, but reading an integer of 2 000 000 digits fail. I might bump a Sagecell limit.
You may try simply