This week's giveaway is in the Groovy forum. We're giving away four copies of Groovy Fundamentals video training course and have Ken Kousen on-line! See this thread for details.

Ryan, much like Ralph, likes 25 but not 24, and he likes 144 but not 145. However, unlike his friend Ralph, Ryan likes 300 but not 400. Which one (and only one) of the following does he like?
a) 37
b) 64
c) 200
d) 1024
e) 65535

This reasoning might be non sense . even though would like to give a try :

here is my Observation :
Lets consider 1 to 10*

Ralphs like:
25 => 2+5 = 7 odd number
144 => 1+4+4 = 9 odd number
300 => 3+0+0 = 3 odd number

Ralph's dislike:
24 => 2+4 = 6 even
145 = > 1+4+5 = 10 even
400 => 4+0+0 = 4 even

Options:
37 => 3+7 = 10 even
64 => 6+4 = 10 even
200 => 2+0+0 = 2 even
1024 => 1+0+2+4 = 7 odd
65535 => 6+5+5+3+5 => 11+8+5 => 19+5 => 2+4 => 6 even

So my guess would be 1024 .

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1032

4

posted

0

Given the information presented so far, that seems like a perfectly reasonable explanation, Seetharaman. You even came up with the correct answer (where "correct" is defined as "what I was thinking"), but for a different reason.

We already know that 25, 144, 300 and 1024 are "likable" but 24, 145, 400, 37, 64, 200 and 65535 are "unlikable". However, I'm going to declare that 8889 is likable while 97 unlikable. How can that possibly be?

Ryan's dislikes:
24 => 4 – 2 = 2 Even 145 => (1+5) – 4 = 2 Even 400 => (4+0) – 0 = 4 Even

Also, as already declared,
8889 => (8+9) – (8+8) = 1 Odd 97 => 9 -7 = 2 Even

So given all the above, the available options are:
37 => 7 – 3 = 4 Even 64 => 6 – 4 = 2 Even 200 => (2+0) – 0 = 2 Even 1024 => (4+0) – (1+2) = 1 Odd 65535 => (6+5+5) – (3+5) = 8 Even

That leaves 1024 as the only option

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1032

4

posted

0

Anubrato Roy wrote:My take is that Ryan likes numbers where the difference of sum of the alternate digits is odd.

I would say that qualifies as "humorously correct". Yes, I do indeed like 1024. Also, the rule you stated will correctly identify numbers I like versus the ones I don't like. However, the statement of the rule is more complicated than the one I had in mind.

If we know that the difference between two numbers is either even or odd, what can we say about the sum of those same numbers?

If two numbers have an even sum, how even numbers did we start with? How many odd?

(Addition is associative and commutative.)

Is there a simpler rule that is equivalent to the "odd difference of sums of alternate digits" one given above?

Anubrato Roy
Greenhorn

Joined: Mar 22, 2010
Posts: 3

posted

0

Hi Ryan,

It was amusing to realize that I have stated the rule in a complicated manner.
Taking your hint, if the difference of 2 numbers is odd, then one of them is even and the other odd - which implies that their sum is also odd.
That combined with my logic simply means that the sum of all the digits in the number must be odd.

So here is the revised version -
You like numbers where the sum of digits of the numbers is Odd.

That makes me realize that this is almost identical to Seetharaman's logic, except that I stop only at the first pass of summing up the digits; and not summing up the digits of the sum itself.

Regards,
Anubrato

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1032

4

posted

0

Anubrato Roy wrote:
So here is the revised version -
You like numbers where the sum of digits of the numbers is Odd.

As it turns out, that's correct as well as now being relatively succinct. What I really like about the "likable" numbers is that they have an odd number of odd digits. ...which turns out to be equivalent to liking numbers where the sum of digits is odd.