Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The tests in Ruby are fine. Closing.
Post your code
Good question.
The two are different. Note that I've used
7/4.0 and not 7/4
because I want a float, not a truncated integer. You can use the following trick: ifx = 7 and y = 4
, then the ratio isx/(y * 1.0)
to get a float.x/y
gives an integer.Use this logic and you will see that
(5,133) cannot be grouped together because 1.2030075187969924 != 1.2, and so on
The trick here is to use a data structure that keeps track of the ratios you have already found, so that if you come across that ratio again, you ignore because you are only taking the lowest member in any ratio. It's quite simple😊
"sıfır" is the correct Turkish spelling; you've used a dotted "i" in the beginning :)
2,3,5,7,11,13,17,19
The list above is a list of primes. The dominant primes in that entire range are 3,5,11,17. Only 11 and 17 are between 6 and 20 and their sum is 28.
The first dominant prime is always 3, not 11 as you have pointed out.
To solve this Kata, list all dominant primes up to the upper limit then pick out the ones that are within the range.