4 kyu
Next polydivisible number in any base
8 of 45JohanWiltink
Loading description...
Algorithms
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.
Very fun Kata! Could not find much information online about polydivisible numbers so had to think up an efficient algorithm carefully.
Indeed, nice kata.
Hi,
in python's random tests, the user is getting invalid string numbers from time to time:
(this situation doesn't happen in JS, for example)
Fixed in this fork: https://www.codewars.com/kumite/6123fffe01ef9f0027c34de8?sel=61557dc90f76ac000e853320
I tried to edit the original translation but I got an error:
Editing the original translation has no way to get the changes into production. Either edit the kata directly or publish a fork, so the fork can be approved ( but you will not be able to approve yourself, so this introduces an extra step - but also an extra check ).
HTML error 422 is Unprocessable Entity - I have no idea what that means, but it's probably a CW problem, for which an Issue in some GitHub repository should be raised.
Fork is approved. Please see if that solves the issue.
yup, it does.
This comment has been hidden.
There are fixed tests for that. In light of your below question, it would probably take quite some ( testing and generating ) time to generate those values specifically, or it would require hardcoding.
I like random tests that are completely, fully random, and there is no specific random generator for overly big numbers ( that'd be the way to ensure it ), though there is a decent chance at least some will be generated, especially for smaller bases.
It might be nice to have, but I just did not specifically include it, and I'm not adding it now.
I understand. The only thing is, my solution uses a heursitic that only holds when b <= 10, so technically I have an incorrect solution. I didn't have to tune this number as it wasn't tested for b > 10.
Precalculating maximum polydivisible numbers for bases from
2
to62
inclusive would make it possible to write a random generator that generates a base and a number larger than the largest possible polydivisible number in that base.I'm not precalculating that stuff myself, and I don't know how to then do the tests in Python. But it would be a useful start to get those tests in. Can I interest you in that?
Sorry, I probably wouldn't be too interested, although I could edit the Python translation if someone else makes a reference test case for a difference language.
It's not really much of an issue, which is why I only marked as a suggestion. If you're happy with the test cases currently, then I can just approve the kata if you'd like.
I'll just approve at 4kyu then if you're happy with that?
I'm happy with that. :]
This comment has been hidden.
This comment has been hidden.
Python translation: https://www.codewars.com/kumite/6123fffe01ef9f0027c34de8?sel=6123fffe01ef9f0027c34de8
Thank you! Approved.
@mauro-1: see issue above, plz
cheers