Tuesday, February 26, 2013

Puzzles

A riddle...
X and Y are two different integers, greater than 1, with sum less than 100. S and P are two mathematicians; S knows the sum X+Y, P knows the product X*Y, and both know the information in these two sentences. The following conversation occurs.
  •  P says "I cannot find these numbers."
  •  S says "I was sure that you could not find them. I cannot find them either."
  •  P says "Then, I found these numbers."
  •  S says "If you could find them, then I also found them."
    What are these numbers?
For those who hate math, here is a different one...


What is yours yet others use more than you do?
(..The correct answer is not your bank account, even though it's a good answer for me...)

I think everyone enjoys a good riddle or puzzle once in a while but how does it effect you when you can't solve it? I know some people that can walk away from a puzzle without a second thought. I am somewhat jealous of these people because I don't have this ability. For this reason I avoid starting some puzzle types altogether. Mommy bans me from some video games for this reason and I have learned to agree with her...sometimes....

A week ago I started into a puzzle. It was work related but the solving of it got personal. I felt like it was taunting me. I knew it was very possible find a solution but it kept eluding me. Every time I began to think I was close to solving it, I would find another step that needed solving. Over and over this occurred until I hit "THE WALL". I generally try to stay as far away from this phenomenon as possible but THE WALL is a point where a real 100% personal effort is being applied and chance of completing the goal mentally feels to be getting infinitely close to zero.

When I hit THE WALL, I was at work on a Saturday morning (wishing to be home) and nearly at the point of shaking my fist at the heavens. I had already yelled a few times because nobody was around but THE WALL actually has a very humbling effect on even someone like me...I stopped....said a 45 second prayer....and a little thought entered my mind that never occurred before...I followed this little thought and in 15 minutes the job was done.

A toast... To Puzzles...May yours be more difficult than you can solve yourself....those are the ones you learn the most from.

For the answers here it is in python. (emulator here http://repl.it/languages/Python )

limit=100
PAllowed1={}
for x in range(2,limit):
       for y in range(x+1,limit-x):
           if x*y not in PAllowed1:
               PAllowed1[x*y]=1
           else:
               PAllowed1[x*y] +=1
SNotAllowed1={}
for x in range(2,limit):
       for y in range(x+1,limit-x):
           if  PAllowed1[x*y]==1 :
               SNotAllowed1[x+y]=1
PAllowed2={}
for n in range(2,limit):
     if n not in SNotAllowed1:
       for x in range(2,n/2+1):
           if x*(n-x) in PAllowed1 and PAllowed1[x*(n-x)] > 1:
               if x*(n-x) in PAllowed2:
                   PAllowed2[ x*(n-x)] +=1
               else:
                   PAllowed2[ x*(n-x)] =1
SAllowed2={}
for n in range(2,limit):
     if n not in SNotAllowed1:
       for x in range(2,n/2+1):
           if x*(n-x) in PAllowed2 and PAllowed2[x*(n-x)] == 1:
               if n in SAllowed2:
                   SAllowed2[n] +=1
               else:
                   SAllowed2[n] =1
for n in SAllowed2:
       if SAllowed2[n] ==1:
           for x in range(2,n/2+1):
               if x*(n-x) in PAllowed2 and PAllowed2[x*(n-x)] == 1:
                  print 'for riddle #2 answer = your name'
                  print 'riddle #1 (S,P) = ( %d , %d ), (x,y)= ( %d , %d )' % (n, x*(n-x) , x , n-x)



I realize that this post was a bit too geeky this week but you get what you pay for around here. I am not a programmer...just a try-to-be some days in a language way over my head.
  • Thing 1 had Spring break from school last week. Weather is getting really nice out. 
  • Mommy and daddy had a date where we saw "Rise of the Guardians".  (4 stars).  
  • Daddy purchased a toy "for the kids"...It's called a Rip-Stick. Like snowboarding on asphalt.Fun..