5 kyu
Generating Numbers From Prime Factors I
334 of 354raulbc777
Loading description...
Algorithms
Data Structures
Mathematics
Dynamic Programming
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.
This comment has been hidden.
Pretty challenging this one, good job.
Bro, can you say me how in this task count of numbers work. I have same final number but different count.
It surely means you're not generating all the possible sequences of primes.
Was fun, if you are using global variables be careful, variables from previous testcases could be used in the next one so you always should declare the new value regarding the global variable at the start of a nonrecursive function :) I guess noone needs that :)
I'd say it's nice to tell the user what the max count of numbers would be. It really does change the way one solves this.
It's still a good kata. And yes, I know it won't get changed, just commenting.
python new test framework is required. updated in this fork
Approved!
What a great kata, SubhanAllah!! Really really enjoyed solving... Alhamdulillah!! I tried other two approches which were rather difficult, but the path to success is infact straight and easy.
Thanks raulbc777!
just passed 111, bigger tests are taking time, just now have a new idea to change the total approach but ........
Lack of many languages
D translation
Approved + 1
Hello everybody! Could someone give me idea, how to solve this kata. Now I'm stacked....
You just need to understand the basic arithmetics concepts of the description. If you are not familiar with it, make researches online, it's easy to find many resources related to it. I believe this is an easy 5 kyu kata and any hint would give away too much of the solution.
One of the most challenging kata that I've done!!!
approved by
Surely this test case in python is incorrect since 13 is a prime number therefore cannot be factored into primes 2 and 3
primesL = [2,3] limit = 200 test.assert_equals(count_find_num(primesL, limit), [13, 192])
I suggest you to read the description.
I honestly don't understand. 13 is prime so it can't be factored into other primes like 2 & 3. How can it be part of the answer?
That's 13 in that case.
COBOL translation, please review carefully. I didn't change the description because that would mean add specific language redundant blocks, and it would not add any extra value. A sane solution would be to make the description language agnostic.
approved
In addition to the unresolved issues pointed out by Blind4Basics, the kata is inconsistent in references to the function and parameters:
Initial solution code: count_find_num(primesL, limit)
Kata description: count_find_num(primesL, val) <- this appears once find_nums(primesL, limit) <- this appears twice
Hi Raul,
Seems there are some inexactitudes in the description:
max number below or equal to limit
while you wrotethe largest number under limit
(which I interpreted as<
)try to generate in order
seens it's not tested.cheers
kata broken (python) by the new runner. Need access to the edit panel and corrections
Edited this one, too. Let me know if you found it ok.
Running both Python 2 and 3
.
Approved
Minor updates done on the description.
BTW, for the random tests,
random.sample()
makes life easier :-)The edits are ok. Thanks for the feedback.
After finishing this kata, I felt like sharing a simple, python-version-safe, but dirty way to calculate the product of a list of numbers :-)
You can do the same in JS too ;-)
prod = eval(arr.join('*'))
Thank you!
Nice kata. :-)
Thanks Steffen. You are so kind. :)
I had to:
from operator import mul
to pass the tests. You should import this function in the test code in case the solution does not import itThanks a lot for the observation. Thanks for your time solving this kata. Your solution upvoted. (+)
Done!!
Thanks! Your kata inspired me to create another. See Set Closure Generator. It has a similar solution; if you solve that one you can apply the solution to solve this kata. Please try it out.