[Jprogramming] Setless SET
Norman Thomson
ndt2 at tutor.open.ac.uk
Sat Jan 14 06:30:01 HKT 2006
Micke,
Thanks very much for pointing me to the website which certainly makes
things unambiguous. And Roger, I took a slightly different line to you,
but I am still a million miles away from counting the number of setless
collections of 20 cards. For what it's worth, my ideas are based on the
fact that any two cards define a set-completing third card. That means
that for a given collection of 20 it isn't intolerable to get the 190
possible completers and see if they are anywhere in the collection. I
have just done this 5000 times for collections of 20 and still haven't
found a setless one. My feeling is that they must be pretty rare, but I
haven't the time left to go 20!81=10^18 times round the loop! Have you
(or anyone else) solved the problem? I would be intrigued to know how.
Best Wishes,
Norman.
com2=.($:@<: , (,.~ i.)@<:)`(0: , 1:)@.(=&2) NB. all combinationss of
2 from n
com2 3
0 1
0 2
1 2
comp=.3&-@:+`[@.=/&> NB. completes 3rd member of set
0 1 1 2 comp 2 1 0 0
1 1 2 1
hasset=.+./@(e.~comp/"2@({~com2@#)) NB. 1 if set is in y.
hasset ?20 4$3 NB. test random set of 20 cards
More information about the Programming
mailing list