Ad
  • Custom User Avatar

    Don't knock your approach just yet. I think we're using the same one, and Javascript's precision craps out around n = 43. Your math is probably fine.

    I'm going to try in Python to verify.

    Edit: Somewhat verified in Python. It works with n = 47, but the python built-in test cases only go to 20, and I'm not willing to build out all the real answers from Wolfram|Alpha to make my own test suite to 200.

  • Default User Avatar

    Update: so, after tinkering around with the javascript for a while i figured out that the approach i was using, which was to generate primes using a sieve method and then do prime factorization on all the numbers in n, combining the sets of those factors i haven't seen yet (duplicates notwithstanding) and returning the product thereof... well it craps out around n = 43... so my approach doesn't scale up i guess for some reason. anyway i learned a lot about math messing around with this which is nice since i haven't thought about prime factorization since i was a young lad. thanks for the fun (even though i didn't solve it :P)

  • Default User Avatar

    Why would my solution fail around n 43? :P