[seqfan] "Graph" button gives wrong results with large numbers

Neil Sloane njasloane at gmail.com
Mon Nov 20 16:51:51 CET 2017


This came up recently in a discussion about drawing the graph of a sequence
with very large numbers.  This is nothing new, we have always known about
this bug, but it is worth reminding people:

There is a real problem with the "graph" button when the terms
of the sequence are bigger than about 300 digits.

The trouble is that we use the statistics language R to make the plots,
and R cannot handle very large integers.  If a number is greater than about
10^300,
then R does something horrible with the number.  In making plots I think it
just omits large numbers,
which means the graphs may be nonsense.

Certainly R cannot do arithmetic with large numbers:
Here are some examples of calculations in R.

> 120+7
[1] 127
> 120^3
[1] 1728000
> 120^400
[1] Inf
> 120^200
[1] Inf
> 10^300
[1] 1e+300
> 10^400
[1] Inf
> 10^40
[1] 1e+40
> 11^40
[1] 4.525926e+41
>
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
[1] 4.444444e+296

So be careful when clicking "graph" if the sequence (including the b-file)
contains numbers greater than 300 or so digits!



More information about the SeqFan mailing list