2

I have a problem, for which there probably is an easy solution.

Suppose, I have calculated a large number in PARI/GP, lets say, 10,000 digits long.

I want to copy this number in a normal text file, such that it can be copied back to PARI/GP.

The problem is, that the program does not avoid (hidden) new-line-marks, so if I copy the number back, it cannot be read by PARI. The print1-command does not help either.

I had two non-satisfactionary ideas :

1) Copying in an editor, using the backspace-key to remove the (hidden) new-line-marks, which only works upto some length.

2) Extending the allowed length of a line, but then I cannot easily and fast mark the number, which is no problem with the normal lentgh 80.

How can I avoid the new-line-marks in the output in PARI/GP ?

Peter
  • 214
  • 1
  • 10
  • 3
    Did you try to use the command 'write(F, str)' allowing to push a custom string 'str' into a custom file 'F'? For example, you can construct your own PARI-readable string like 'Str("{", , "}")'. – Piotr Semenov Sep 18 '15 at 08:49

1 Answers1

2

Piotr already gave the answer in a comment. Suppose you have:

n = 1<<33216

or any other number. Then if you use:

write("MySavedNumber.txt", n)

things will be fine. No new-lines in the middle of the text file.

When you need to recover the number in another session of PARI/GP, simply use:

n = read("MySavedNumber.txt")
Jeppe Stig Nielsen
  • 60,409
  • 11
  • 110
  • 181