Ad
  • Default User Avatar

    I think that n%3 mean that a number divide by 3 and what you want is the remainder. n//3%3 mean that you are diving the number dirst and rounding it down, then you are doinging another division and looking for it's remainder. Same with n//9%3 This just mean that you are dividing by 9 first and rounding down, then you divide by 3 and get the remainder.
    For example;
    5%3 would have a remainder of 2.
    5//3%3 would be 1.66 and round down would have 1, then you find the remainder which is 1.
    12//9%3 would be 1.33 and round down you get 1, then you find the remainder of 1/3 which is 1.

  • Custom User Avatar

    In the table given in the kata description, observe that P1, P2, P3 are simply counting in ternary. So this kata is an exercise in converting a decimal integer to ternary.

  • Custom User Avatar

    Posting a solution here is forbidden, if your code is ok, it passes the tests, and you can discuss it in Solutions section. If you have a Question and your code doesn't work, you can post your code here, marking the post as having spoiler content and using markdown formatting. Please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#post-discourse

  • Custom User Avatar

    Don't post solutions in kata Discourse.