7 kyu

Vampire Numbers

2,790 of 7,096AlejandorLazaro
Description
Loading description...
Fundamentals
View
AllIssues10Questions1Suggestions4Show Resolved
  • Please sign in or sign up to leave a comment.
  • potzko Avatar

    hi, I would reccomand having a small edge case section in the code for (0,0), (1,1), (0,1), (-1, 0), (-1, 1) etc preferably in the sample test also also, maybe adding some random testing would be a good idea, however make sure you genrate random ints and cast them to longs, as dealing with the edges of representable numbers was not defined. best of luck :)

  • potzko Avatar

    This comment has been hidden.

  • rowcased Avatar

    JavaScript Fork

    • updates to chai
    • corrects function name casing without invalidating old solutions
    • adds random tests
  • ejini战神 Avatar

    Python:

    test.expect is used

  • akar-0 Avatar

    In JS the function name should be in camelCase.

  • user9644768 Avatar

    Please use new python test framework.

  • user4896126 Avatar

    enjoyable!

  • user9644768 Avatar

    No random tests in any language.

  • WestwardLand968 Avatar

    Python function name should use snake_case, not PascalCase. MixedCase is only used for compatibility purposes.

  • Souzooka Avatar

    C#: Translation does not follow naming/bracket conventions.

    Method names should be PascalCase, not snake_case, and opening brackets should be on new lines.

    static class Kata{
      public static bool vampire_test(long x, long y){
        
      }
    }
    

    should be

    static class Kata
    {
      public static bool VampireTest(long x, long y)
      {
        
      }
    }
    
  • toliboff Avatar

    All test passed beside test5: Large: 2947050 * 8469153 = 24959017348650 should return True Expected: True But was: False

    In my IDE it returns "true". What I'm doing wrong

  • IRailean Avatar

    test8: Large: 2947050 * 8469153 = 24959017348650 should return True Expected: False But was: True

    test5: Large: 2947050 * 8469153 = 24959017348650 should return True Expected: True But was: False

    Fix it please.

  • hend_xxx Avatar

    ✘ Large: 2947050 * 8469153 = 24959017348650 should return True Expected: False But was: True

    My Code Begin with public static bool vampire_test(long x, long y){ Console.WriteLine(x); Console.WriteLine(y);

    The Result is test8 Log 0 0 ✘ Large: 2947050 * 8469153 = 24959017348650 should return True Expected: False But was: True Completed in 0.009067ms

    Why Log is Zero?

  • BlendArt Avatar

    Something is wrong with test8: test8 Large: 2947050 * 8469153 = 24959017348650 should return True Expected: False But was: True

    Expected value should be True

  • donaldsebleung Avatar

    Javascript version of Kata could include random tests :)

  • PantlessBandit Avatar

    Getting this error, although, my code runs fine in fiddlesalad:

    kata: Unterminated string constant:61 Test.assertEquals(vampire_test(2947051,8469153) , false,

  • pskelley Avatar

    Not true vampire # test. A vampire # can not be odd number of digits, the fangs have to be split evenly, it's the first sentence of the wikipedia article...

    " vampire number is a composite natural number v, with an even number of digits n, that can be factored into two integers x and y each with n/2 digits and not both with trailing zeroes.

    So 126 isn't a vampire number.

  • maryAndreeva Avatar

    This comment has been hidden.

  • SUSREE64 Avatar

    When I check up this wiith my Jetbrains IDE , it works, but does not work here . Please suggest. result = sorted(list(str(x*y))) key = sorted(list(str(x))+list(str(y))) if result == key: return("True") else: return("False")

  • buckypimpin Avatar

    This comment has been hidden.

  • user3012216 Avatar

    This comment has been hidden.

  • mrad Avatar

    Anyone else has a solution passing for every test but Large: 2947051 * 8469153 = 24959025817803 should return False ?

  • Night Idol Avatar

    Thanks for kata. But not all rules from article in Wikipedia are observed in tests. For example it's string from article: "For example: 1260 is a vampire number, with 21 and 60 as fangs, since 21 × 60 = 1260. However, 126000 (which can be expressed as 21 × 6000 or 210 × 600) is not, as 21 and 6000 do not have the correct length, and both 210 and 600 have trailing zeroes" But last test vampire_test(210,600) returned true - it's not correct. Thanks for your kata.

  • itsmemattchung Avatar

    After saving solution and running the test, the error is : "Unknown error". Has anybody seen this issue?

  • MMMAAANNN Avatar

    Something is wrong with this. I cannot test or submit anything because I am getting the following error:

    File "", line 7 test.expect(vampire_test(21,6) == True, "Basic: 21 * 6 = 126 should return True") ^ SyntaxError: invalid syntax 0 Passed 0 Failed 0 Errors Process took 27ms to complete

  • HEXecutive Avatar

    Cut and paste my solution into a shell and tried each of the tests, all cases seem to be accounted for. The site times out both testing and submitting however. Perhaps something is broken with the site? Will try to resubmit later.

  • msausa Avatar

    This was fun. Thank you! One thing to note that isn't specific to the kata itself but may be helpful to those new to code wars, I tried multiple times to submit via firefox and was unable to and had to copy/paste the link to chrome in order to succesfully submit.

  • pmatos Avatar

    I have a program that I am very sure it should pass (passes all tests under Chrome console) but doesn't seem to be accepted. How can I understand what's wrong?

  • floum Avatar

    Hi, when checking the wikipedia page, it seems that each fang should have the same length, the lowest one being 1260. Any idea why 21 * 6 should be a vampire number?

  • GiacomoSorbi Avatar

    Today I had other things to do, but as it expected it only to take few minutes and as I both enjoyed it and wanted to refresh my Ruby a bit, here you have it translated into Ruby :)

    Note: I added a js one, but it is still lacking a Haskell example in the description.

  • wthit56 Avatar

    Interesting kata. There's a couple of tweaks you could make to make it that little bit better:

    • The first code snippet has a typo--it says "mutliplicands" instead of "multiplicands".
    • It seems that all of your randomly-generated tests are not vampire numbers. If possible, it would be good to have at least some be valid.

    Other than that, good job. I enjoyed writing this ;P

  • bkaes Avatar

    JS and Haskell translations kumited.

  • ZozoFouchtra Avatar

    This comment has been hidden.

  • JS01 Avatar

    This comment has been hidden.