6 kyu

The BIG Pronic challenge

72 of 142LesRamer
Description
Loading description...
Algorithms
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Phil157 Avatar

    ```Not wishing to criticise, but with both of the other solutions using a formula with 3x INT() and 2x SQRT() I just wonder whether that would be preferred over my formulation. Though I would use your is_pronic = ... in preference to my IF statement, if I'd thought of it. :o)

  • donaldsebleung Avatar

    Fortran Translation Kumited - please accept :D

  • Jomopipi Avatar

    jeez I sure took the long way... who wants to check out my solution haha

  • Hullaballoo Avatar

    Added Java Translation

    Attempting to keep as true to original Test Cases as possible, although safeguard against repeated 0 tests has been added.

    • LesRamer Avatar

      It looks like the initial/sample-test is just an empty template test. Let's add a few sample tests, but otherwise it looks good.

    • Hullaballoo Avatar

      Aha, I completely overlooked the sample test cases because of the description. Changes have been made so sample-tests match actual tests as per description.

    • LesRamer Avatar

      In case you missed it, I approved.

      I added a new test to the c# implementation. The new test is SquaresAreNotPronicTests which tests 10,000 perfect squares from (32768)^2 through (42767)^2. In retrospect, I should probably have went much larger with the squares -- I should have gone much closer to the Int64 max.

      I'm thinking this new test should be implemented in java as well. I may take a swing at it -- since the Java syntax isn't far from that of c#.

      I wish I had implemented this test sooner since it invalidated a couple of implementations (including one that surprised me that it invalidated.)

    • donaldsebleung Avatar
      Suggestion marked resolved by donaldsebleung 7 years ago
  • CIS 122 Avatar

    My solution is pretty trivial but it passed all your tests. From the description, I'm guessing you might need some tests that make my solution fail.

    • LesRamer Avatar

      The "large-value-branch" in my original algorithm was the same approach as yours. Testing it with smaller data proved that it worked, so I revised the algorithm. The extra test cases I added in the process also caused problems for the 1 + 4 * n algorithm that I have since provided as the initial solution. I like this better than the previous throwing of NotImplementedException. I've labored pretty long on this and you helped to make it better. So thank you so much for your feedback! My goal in this kata was to get coders to think about and deal with size limitations like overflow. I'd like to do other kata that deal with overflow and underflow. Let me know what you think. Thanks.

    • CIS 122 Avatar

      Sounds good to me. I like challenges that brush up against language and processing limitations. My favorites are the ones that seem really easy, but turn out to require some cleverness to solve.

    • LesRamer Avatar

      :)