5 kyu
Following the Paths of Numbers Through Prime Factorization
128 of 166raulbc777
Loading description...
Mathematics
Data Structures
Fundamentals
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.
Great math kata to have some fun with by the way.
python new test framework is required. updated in this fork
At least Python: All test cases count 1 extra divisor, which is wrong.
Even the kata description is wrong: there are 70 not 71 factors in the example list: [2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 15, 18, 20, 24, 25, 26, 30, 36, 39, 40, 45, 50, 52, 60, 65, 72, 75, 78, 90, 100, 104, 117, 120, 130, 150, 156, 180, 195, 200, 225, 234, 260, 300, 312, 325, 360, 390, 450, 468, 520, 585, 600, 650, 780, 900, 936, 975, 1170, 1300, 1560, 1800, 1950, 2340, 2600, 2925, 3900, 4680, 5850, 7800, 11700].
JS Node 14 should be enabled
Python new test framework should be used
Description should be language-agnostic
The upper bound of output should be specified at least ( or mention about performance requirements )
My code is working properly after clicking on the test button but I'm getting the message as 'execution timed out' after clicking on the attempt button.
time out .How to fix it
The big hint here is find a way to efficiently compute the total number of divisors.
Testing for: [ 1301 ]
Expected: [1301, 1, 1301, 1]
In accordance to task conditions:
[1301 - number, to which the prime factorization belongs
1 - divisors count
1301 - min divisor
1 - max divisor]
How it's possible?? 1 and 1301 shouldn't be taken into account. That's why the result array must be like [1301, 0, 0, 0]. Who can explain?
I'm a little stuck on this one. I can get the first 3 parts, but my max divisor is wrong, even though I'm dividing the same product by the same minimum divisor, which mathematically should get me the max divisor?
For example:
[640210194275124949, 53, 7, 91458599182160704] should equal [640210194275124949, 53, 7, 91458599182160707]
My own IDE returns 91458599182160704 as the max divisor, so I'm not totally sure what's going on
This comment has been hidden.
I was getting the same thing. For Python 3.x, use a//b instead of a/b to handle the float to int problem.
Enabled for python 2 and 3!
It will be enabled for Python 3 soon.
JavaScript translation submitted. Numbers are limited to 2**53, but other than that it's the same :)
Approved
I am sorry, but your test cases failed to count the factors in the way as in the kata description. Please consider to revise them so that at least they agree.
For example, in your case of 297, the factors that you want to count is
There is still 1 and 297, but they are not expected to be counted, as you said
Thence the second item of the answer should be 6, instead of your given 7.
UPDATE
I found your definition of 'total divisors' (= prime + compound) agree with the test cases. All you need to change is the list in the example of 23400 in your kata description.
Seems already fixed
No, it is NOT fixed. All test cases count 1 extra.
Even the kata description is wrong: there are 70 not 71 factors in the example list: [2, 3, 4, 5, 6, 8, 9, 10, 12, 13, 15, 18, 20, 24, 25, 26, 30, 36, 39, 40, 45, 50, 52, 60, 65, 72, 75, 78, 90, 100, 104, 117, 120, 130, 150, 156, 180, 195, 200, 225, 234, 260, 300, 312, 325, 360, 390, 450, 468, 520, 585, 600, 650, 780, 900, 936, 975, 1170, 1300, 1560, 1800, 1950, 2340, 2600, 2925, 3900, 4680, 5850, 7800, 11700].
This comment has been hidden.