# What do I do when I get an “Iterator does not have appropriate bounds” error?

I used this as input

Table[600851475143/i , {i, 1, 600851475143}]


but got an error

Table::iterb:Iterator {i,1,600851475143} does not have appropriate bounds.


But this gives me no error why?:

Table[600851475143/i , {i, 1, 13}]

-
If the error message is followed by two little angle brackets (>>) you can click on these to read more about the error. I didn't realize this for a while... :) –  cormullion May 12 '12 at 9:17
LoL. I was just going to write the same question for the third problem of the project Euler, then the SE suggested your question. I laughed when I saw the number. –  Vÿska Aug 26 '12 at 10:51
I solved it like this: Select[Divisors[600851475143], PrimeQ] –  Vÿska Aug 26 '12 at 10:58
Last[Select[Divisors[600851475143], PrimeQ]] for more speed! –  Vÿska Aug 26 '12 at 11:02

This is because the number you used is extremely large. The number of iterations supported (in either Table or Do) seems to be $2^{31}-1$, i.e. the maximum size of a signed machine integer. I believe this is also an upper bound on the size of an array in Mathematica.

This limitation is not unreasonable: the size of the Table you are trying to construct is too large to fit into memory anyway. (Even if each element could be stored on a single byte, you'd be asking for 600 GB of memory.)

If you change the step size in the iterator to a large number, it will work:

Table[600851475143/i, {i, 1, 600851475143, 100000000}]

-
Thanks......... –  The-Ever-Kid May 6 '12 at 10:53
@Szabolcs This is weird, isn't 1 the default step size? I did Table[x, {x, 1, 10}] and it gives me {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. –  Vÿska Aug 26 '12 at 10:54
@Szabolcs I also tried the same with this 600851475143/Range[1, 600851475143, 1] and it still gives me this error. –  Vÿska Aug 26 '12 at 10:59
@Gustavo Yes, 1 is the default step size. I don't understand your comment, can you explain? –  Szabolcs Nov 12 '12 at 19:55
@Ruslan The command quoted in the question does not give an error on a 64 bit system like it does on a 32 bit one, so I guess that this limitation is not there on 64 bit systems. I do not know where this is documented (if it is at all). –  Szabolcs Oct 21 '14 at 17:36

As Szabolcs has said the trouble lies in the size of the table you are trying to produce.

It does not however stop you plotting the function you want to investigate.

Plot[600851475143/i, {i, 1, 600851475143}]


Or sampling the function at discrete steps and then plotting it as in:

z=Table[600851475143/i, {i, 1, 600851475143, 10^6}];
ListPlot[z];


-