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.
thanks, I didn't know!
In camel case the first word is lowercase. https://www.freecodecamp.org/news/snake-case-vs-camel-case-vs-pascal-case-vs-kebab-case-whats-the-difference/
But excuse me, is this normal? s='G' => ' G' In my opinion the function should return 'G'
Similarly 'GrDn' => ' Gr Dn' but it should be: 'GrDn' => 'Gr Dn'
It's strange that this solution passed all the tests
Except C++!
This kata is language-agnostic. The solution string behaves the same in all programming languages.
my favourite solution so far. Concise but still super readable
if you google that and still learn nothing from the solution, i'd say it's your own fault
At first I was frustrated because I could not figure out (8 kyu, 30 minutes struggle lol), then I realised I should check on wiki.
Well, it's not a good coding challenge, but it was useful, because now I know Wilson primes is a thing.
At the end of the day this kata was still useful.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The generalization does affect the definition. Generalizing from the whole numbers to the integers (includes negative numbers) makes it natural to generalize the definition of primes. It's strange to do so since generalizing to complex numbers is more useful.
I read the description again. It leaves no ambuiguity, so the fault is on me. I just saw negative numbers and primes and assumed we would use a definition generelized to integers. I should have been more diligent before making an issue. My only excuse is that there are others.
Wikipedia's article first sentence is "A prime number (or a prime) is a natural number...". This excludes de facto negative integers. In the paragraph you mention: " The integers are a ring, and the prime numbers in the integers have been generalized to rings in two different ways,.." This is a generalization of prime numbers, and doesn't affect the definition of what is a prime number. Moreover, if anyone would have a doubt, the description clearly explains what must be considered a prime number in this kata. Removing the kata for this would just be ridiculous.
Go translation
Maybe just remove this Kata? In Python the tests are stating that -5 and -41 are not prime. That's not correct.
I know that the definition they teach this is something like this: A prime is a positive integer p>1 that has no positive integer divisors other than 1 and p itself.
Negative numbers are excluded. In fact, they are given no thought. Wikipedia does the same. Notice how it's not mentioned that no negative number is a prime on the wiki page. It's simpler and for most purposes not addressing it works.
Now if you actually want to check if a negative number is a prime you should extend the definition to handle negative numbers.
https://en.wikipedia.org/wiki/Prime_number#Prime_elements_in_rings
https://math.stackexchange.com/questions/1002459/do-we-have-negative-prime-numbers
It's merely conventional, but if you admit that there are negative primes (or that
1
is prime BTW), you break the Fundamental theorem of arithmetic, which does more harm than good.Loading more items...