Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript for Project Euler problems

Tags:

javascript

I am trying to solve Q10 from Project Euler. I am using JavaScript and Sieve of Atkins algorithm to solve the problem. When I run the code on browsers(Safari and FF) the browsers prompts that the script is unresponsive. Even if I let the script to continue I never got the answer. I know there are threads for the same Project Euler problem.

My questions would be:-

1.How far JavaScript is capable to solve such complex mathematical problems for browsers?

2.Is there any other environment where I can I test my JavaScript programs?

Thank you All.

like image 525
SocialCircus Avatar asked Dec 03 '22 07:12

SocialCircus


1 Answers

  1. I would have thought as capable as any other - JavaScript implementations have been optimised a lot in recent years thanks to increased used in the web.

  2. You can use either node.js or CScript (a command line version of the Windows Script host - this is supplied as part of Windows).

If I remember my implementation of that question (in Python) was significantly slower than I thought it would be. The chances are the slowness is due to your algorithm rather than the language.

like image 185
Justin Avatar answered Dec 05 '22 19:12

Justin