5 kyu

Right Truncatable Harshad numbers

57 of 90anter69
Description
Loading description...
Mathematics
Number Theory
Algorithms
  • Please sign in or sign up to leave a comment.
  • ahmet_popaj Avatar

    You've surely enough got to come up with a way to pass the tests given the high constraints, that's why it's challenging and I liked solving it.

  • dfhwze Avatar

    Could use tag: number theory

  • rajat004 Avatar

    This comment has been hidden.

  • abajpai2 Avatar

    This comment has been hidden.

  • docgunthrop Avatar

    Elixir translation awaiting approval.

  • docgunthrop Avatar

    A nice kata, but it's a shame that runtime for Python is so slow. I initially wrote my solution in Python which would not pass due to timeout, but the exact same algorithm in JS yields a successful completion in 2 seconds.

  • JekaGrib Avatar

    Im sorry. Solution, which i submitted, is bad and too large. Because of this, my (and probably not only mine) browser crashes when I open solutions in this kata and "my solutions" in account. I dont know, how to solve this problem. I wish i could remove this solution, but, as I know, this is unavail.

  • guillegarciabust Avatar

    For some reason, my code works perfectly on my laptop's terminal but gets timed out here. Why?

  • JohanWiltink Avatar

    JavaScript translation

    Note: b limited to Number.MAX_SAFE_INTEGER ( 2**53 - 1 ~ 9e15 ); description updated for JavaScript.

  • Unnamed Avatar

    Haskell:

    • Couldn't match expected type ‘Integer’ with actual type ‘Int’ • In the first argument of ‘rthnBetween’, namely ‘a’ In the first argument of ‘shouldBe’, namely ‘rthnBetween a b’

  • JohanWiltink Avatar
  • lechevalier Avatar

    Still have the feeling that this upper bound may be too low for a 5 kyu kata :-P

  • stauntonjr Avatar

    Fun kata. I think the description is refreshingly nice and clear so kudos. Unfortunately I haven't thought up a fast enough implementation yet :P

  • GReaSe Avatar

    Exhaustive enumeration takes too much time for big numbers, so cannot pass through random test (timeout).

  • dasoca Avatar

    Kind of tough for a 5 kyu (because of performance requirements). But fun!

  • Unnamed Avatar

    The kata has become approvable, so I think I should reopen the issue. See below.

  • Unnamed Avatar

    0, 20 --> [10, 12, 18, 20]

    Where are 1, 2, 3, 4, 5, 6, 7, 8, 9?

  • Blind4Basics Avatar
    • you should add some other fixed tests with small values but wide range, like [30,100]
    • and you could even go higher (both in upper liimt and number of tests), but not sure that would be usefull, yes.
    • the last sample test isn't a good idea, tho: too high values.

    EDIT:

    And you should make it clear explicit that values below 10 are Harshad numbers but are not truncatable, so they aren't in the sequence.