Ad
  • Custom User Avatar

    (I've stepped away from codewars so, I apologize it took this long before I noticed your message.)

    I felt I was clear both in the title and the description that what is sought is "special-parasitic numbers ending in N". I gave examples in the description and I note that the answers for all of the base-10 portion are under the "strict definition" section of the wikipedia link that I provided in the original kata description.

    So, while 142857 * 5 = 714285, 142857 does not end in 5 like the title and description request. The smallest that ends in 5 that is parasitic is 102040816326530612244897959183673469387755.

    I suspect what was confusing was that my meaning of "smallest," as defined in the description, differed from a similarly named section of the wikipedia link. In the 104 hex * 4 = 410, we could have repeated 104 any number of times and the property still holds. 104104104104104 hex * 4 = 410410410410410 hex -- the number the kata wants is 104, not 104104, 104104104, etc.

    IMHO, the fun challenge here is that the "ending in N" portion is what pushes some of the solutions into large numbers which cause problems for brute force approaches.

    (Note that the solution for all base-10 answers also appear in that strict-definition section.)

    I don't have a problem with the wording, but I'm open to suggestions that would improve the kata.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
  • Custom User Avatar

    Thanks for your hint, just fixed the two testcases;-)! More than 25 years ago i wrote this code (for codewars i translated it from c++ to c#), so it's really old. Probably it will never come out of beta:-)... Again thanks for your work;-)!

  • Default User Avatar

    Thanks! It was interesting to solve it. Hard kata. I had to remember gauss method that I learn many years ago in univercity.
    One issue there: I guess that in 1 and 5 tests are double space between numbers. I pass this tests only when I use rows[ir]=rows[ir].Replace(" "," "); in my code.
    Of course correct regex is also decision, but may be it is better to fix tests.

  • Custom User Avatar

    Wow:-)! Just saw... first solution here since more than one year, so at least one extra clever point - really good work;-)!! Thought nobody will solve it the next 10 years;-).
    By the way there's a simpler version, if you reduce your code you can solve it too: https://www.codewars.com/kata/solving-linear-equations-n-x-n-gauss-part-1-slash-2