I'm currently working on problems in Project Euler with JavaScript. For the most part I've been using for
loops to iterate through the problems but wanted to use recursive functions. However, it seems that all of the JavaScript engines have limits to the amount of recursion they can handle.
I compiled/installed SpiderMonkey to try and run from the shell, but still get 18: InternalError: too much recursion
Is there anyway to increase the recursion limit in SpiderMonkey, or is this just a bad idea in general.
Code example:
function cycle(x)
{
if (check_divisble(x))
{
print(i + ' is divisble by 1 - 20' + '\n');
return;
}
x+=20;
cycle(x);
}
cycle(50400);
Thanks for your help.