You are viewing a single comment's thread. Return to all comments →
For everybody who are struggling with timeout problem.Dont go through the loop to check whether a given number is pentagonal number.Just check,
n=(sqrt(24*x+1)+1)/6; if x is a pentagonal number then n should be a natural number.
Hope this helps!!!
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #44: Pentagon numbers
You are viewing a single comment's thread. Return to all comments →
For everybody who are struggling with timeout problem.Dont go through the loop to check whether a given number is pentagonal number.Just check,
n=(sqrt(24*x+1)+1)/6; if x is a pentagonal number then n should be a natural number.
Hope this helps!!!