6 kyu
The BIG Pronic challenge
72 of 142LesRamer
Loading description...
Algorithms
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
```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)
Fortran Translation Kumited - please accept :D
Approved.
Wow, I haven't really even looked at Fortran since my college days.
Thanks,
jeez I sure took the long way... who wants to check out my solution haha
This comment has been hidden.
Added Java Translation
Attempting to keep as true to original Test Cases as possible, although safeguard against repeated 0 tests has been added.
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.
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.
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.)
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.
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 ofNotImplementedException
. 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.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.
:)