Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OddEven Kata #8

Closed
keraton opened this issue Jun 17, 2014 · 10 comments
Closed

OddEven Kata #8

keraton opened this issue Jun 17, 2014 · 10 comments
Assignees
Labels

Comments

@keraton
Copy link

keraton commented Jun 17, 2014

The definition of OddEven kata is a confusing, it says :

  • Print "Odd" instead of number, if the number is odd, means not divisible by 2 but not divisible by itself too

I think the definition of odd is not divisible by 2. There is no need to add the words not divisible by itself.

@garora
Copy link
Owner

garora commented Jun 18, 2014

Thanks Bowie - to make this note, I can correct this only in weekends, if
you do not have issues, please do it and can refer:
http://en.wikipedia.org/wiki/Parity_%28mathematics%29

On Wed, Jun 18, 2014 at 1:53 AM, Bowie Brotosumpeno <
notifications@github.com> wrote:

The definition of OddEven kata is a confusing, it says :

  • Print "Odd" instead of number, if the number is odd, means not
    divisible by 2 but not divisible by itself too

I think the definition of odd is not divisible by 2. There is no need to
add the words not divisible by itself.


Reply to this email directly or view it on GitHub
#8.

Thanks & Regards,
Gaurav Arora

@garora
Copy link
Owner

garora commented Jun 20, 2014

@keraton - whole idea of odd/even kata is in this line: If number is odd print 'Odd' instead of the number. If number is even print 'Even' instead of number. Else print number [hint - if number is Prime]. I updated the steps accordingly.

@garora garora self-assigned this Jun 20, 2014
@garora garora closed this as completed Jun 20, 2014
@awvalenti
Copy link

How can a number be neither odd nor even?

@shubyarora
Copy link

That is a prime number

Sent from Samsung Mobile

-------- Original message --------
From: André Willik Valenti notifications@github.com
Date: 16/10/2015 9:39 PM (GMT+05:30)
To: garora/TDD-Katas TDD-Katas@noreply.github.com
Subject: Re: [TDD-Katas] OddEven Kata (#8)

How can a number be neither odd nor even?


Reply to this email directly or view it on GitHub.

@garora
Copy link
Owner

garora commented Oct 17, 2015

@awvalenti - good. In mathematics, we have lot of things related to Number system viz. Parity, Prime Number etc. I wouldn't want to go in that details, lets stay to our oddevenkata example. When one said print even if number is even, print odd if number is odd else number of check if its a prime number, which means we have to identify programatically that is entered number `odd, even or prime``.

Please refer to above reply : garora commented on Jun 20, 2014. It will clear, so, the real time scenario would be if number is not even or odd means if it is a prime number.

eg. Entered numbers: 1,2,5
In above, what would you expect as an output: odd,even,odd or odd, prime,odd or odd,even,prime or odd,prime,prime.

You can think any of above, if trying to correlate with actual maths, but here it would be: odd,even,odd,2,5
So, it should print 2 and 5 additionally as these are prime numbers

Here is a list of prime numbers.

I got an idea to write a new Kata: primecompositekata.

Please let me know if you need more discussion. I am reopening this issue for a while.

@garora garora reopened this Oct 17, 2015
@garora garora added the How to label Oct 17, 2015
@jan-xyz
Copy link

jan-xyz commented Jun 24, 2017

Wow, I just worked on this Kata and only found this issue afterwards. I spend most of the time trying to understand what you are talking about in the instructions. Correct me if I'm wrong:

  • if the number is even: print "even" (n%2 == 0)
  • else: print "odd"
  • Additionally, print all prime numbers that you find in the input.

@garora
Copy link
Owner

garora commented Jun 25, 2017

@jan-xyz - you discovered it nicely. Have you gone through this discussion?
We need to print Even, odd and prime numbers. What issue you found in the instructions. Can you provide the instructions as per your. Here is the main motto of this Kata - on the other hand you can call it as Odd Even Prime Kata.

  • Print Even if number is even
  • Print Odd if number is Odd
  • Print Number if number is neither even nor odd i.e. number is Prime number.

@jan-xyz
Copy link

jan-xyz commented Jun 27, 2017

A number is always either even or odd. More specifically, every prime number is also odd. In that case, option three would never trigger.

@garora
Copy link
Owner

garora commented Jun 27, 2017

@jan-xyz - its a bit confusing, dont wanna to go in debate, here are my views:

Every Prime number is Odd. But, can every Odd number be Prime? e.g. 9 is odd (not
divisible by 2). Is 9 a Prime (it is divisible by 3 as well) ?
So, not all odd numbers are Prime - e.g. 9,15,21,27...
In this scenario - 3rd condition will trigger.

@garora
Copy link
Owner

garora commented Jul 3, 2017

@jan-xyz - I am closing this issue.

@garora garora closed this as completed Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants