10/20/08 Car Talk Puzzler

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

10/20/08 Car Talk Puzzler

Hal 9000
For those who like Car Talk, here's another SPSS approach to solving
the puzzler!

This is only a partial solution, but it yields enough information to
solve the puzzle. It's lazy - I know.

Here's the puzzle, copied from the Cartalk.com website:

Week of 10-20
NEW PUZZLER: The Perfect Square Dance!
Sally invited 17 guests to a dance party. She assigned each guest a
number from 2 to 18, keeping 1 for herself. The sum of each couple's
numbers was a perfect square. What was the number of Sally's partner?

Here's my crack at a solution - please share your superior one if you
are inclined! :


*.
data list free /Idx (f2.0).
begin data
1 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18
end data.

vector P(17 f2.0).
loop #I = 1 to 17.
do if mod(sqrt(Idx+#I),1)=0
 and Idx<>#I.
compute P(#I) = #I.
end if.
end loop.

count N = P1 to P17 (lo thru 17).
exe.
*.

-Gary

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD