can someone explain please why for this intervals [[1, 5],[10, 20],[1, 6],[16, 19],[5, 11]] the sum is 19?
how do they merge? why [[1,5],[1,6],[5,11]] does not become [1,11] ?
You need to find the prime factors of all elements of I, then produce the sum of all elements of I that share that prime factor: [(prime factor p1, sum of all elements of I with prime factor p), (prime factor p2, sum of all elements of I with prime factor p2), ...]
But there is something wrong with tests. I reloaded the page after typing log and all of them passed
Well actually they had to
It was pretty tricky to solve this kata steadily adding conditiions which could happen
Something like '(-2 - 2 + (21.32 - (4 * 1)) + (3 * -2.22)) + 3 + (1 + 2) + (11 * 1 - (22 + 2 / -77.44 + (77 / -7.3 - 4 + 2 * 2.11 / 1 * 2 * 3)))' is not written as a possible input value but might be there, obviously
ok, got it, thanks for the reply
Those 3 can become [1,11], but you have there [10,20] too, and in the end, all of them become [1,20].
can someone explain please why for this intervals [[1, 5],[10, 20],[1, 6],[16, 19],[5, 11]] the sum is 19?
how do they merge? why [[1,5],[1,6],[5,11]] does not become [1,11] ?
nope they're not
Turns out that only 2,3,5,7 are valid numbers
Thanks! :D.
@kingcobra_
You need to find the prime factors of all elements of
I
, then produce the sum of all elements ofI
that share that prime factor:[(prime factor p1, sum of all elements of I with prime factor p), (prime factor p2, sum of all elements of I with prime factor p2), ...]
i actually didnt understand the kata.
is it like finding the factor of a number which is prime?
Yes, that's why you get [3, 27 = 12 + 15] and [5, 15]
but 5 and 3 are prime factors of 15 right
6 is not a prime number.
I = [12, 15]; //result = [[2, 12], [3, 27], [5, 15]]
Why result doesn't include [6, 12] ??
Thats also a valid value
Appreciated!
But there is something wrong with tests. I reloaded the page after typing log and all of them passed
Well actually they had to
It was pretty tricky to solve this kata steadily adding conditiions which could happen
Something like '(-2 - 2 + (21.32 - (4 * 1)) + (3 * -2.22)) + 3 + (1 + 2) + (11 * 1 - (22 + 2 / -77.44 + (77 / -7.3 - 4 + 2 * 2.11 / 1 * 2 * 3)))' is not written as a possible input value but might be there, obviously
https://docs.codewars.com/training/troubleshooting#print-input
Help please, where can I see the input values of random tests?