The 10001st Prime Number is 104743.
Please find the code in primenumber.js
file.
- In the code a cache is used to do the calculation more efficiently. When calculating the number for the 1st time, it takes around
23.35302734375ms
, but if we run it again, it takes just0.260986328125ms
. - If next time we try to get the 10002nd prime number, The program will only calculate the 10002nd prime, because the previous 10001 numbers are already saved in the cache. This is again a huge performance benefit.
- In NoSQL each document can have its own unique structure. So when the schema of the data is not consistent and can change at any time, NoSQL is preferred. Its very flexible to add new kind of data without affecting existing data.