Hello. I have had some problems with a function that I have defined. I am getting a number returned when a list should be returned. What I want to do is get a list of all the primes under 1000000. I am trying to do this by testing whether the prime is above 1000000 and if it is, returning y, else calling the function again with the next x and the current prime prepended to the accumulated list. Here is the code:
Loopy[x_, y_] :=
prime = Prime[x];
If[prime > 1000000, y, Loopy[x + 1, Prepend[y, prime]]];
Thanks for any help, in advance.