// arthur whitney x:(0 6 0 1 0 4 0 5 0 0 0 8 3 0 5 6 0 0 2 0 0 0 0 0 0 0 1 8 0 0 4 0 7 0 0 6 0 0 6 0 0 0 3 0 0 7 0 0 9 0 1 0 0 4 5 0 0 0 0 0 0 0 2 0 0 7 2 0 6 9 0 0 0 4 0 5 0 8 0 7 0) / all g:{$[0>m:|/i:b x;,x;,/g'p[x;i]'f x i?:m]} / all with special case g:{$[0>m:|/i:b x;,x;8=m;g p/[x;i;*:'f x i:&i=8];,/g'p[x;i]'f x i?:m]} /format G:{(9*!9)_-511+*g p/[81#0;i;-1+x i:&0http://markbyers.com/moinmoin/moin.cgi/ShortestSudokuSolver p:+{(=x)x}'p,,3/:_(p:,/'+:\9#'!9)%3 1@,/$*{$[&/x;,x;,/.z.s'@[x;i;:;]'&27=x[,/p i:x?0]?!10]}@.:'*.z.x; p:+{(=x)x}'p,,3/:_(p:,/'+:\9#'!9)%3 *{$[&/x;,x;,/.z.s'@[x;i;:;]'&27=x[,/p i:x?0]?!10]}@.:'*.z.x \ first pass is 88 bytes (on ints) p:+{(=x)x}'p,,3/:_(p:,/'+:\9#'!9)%3 f:{$[&/x;,x;,/f'@[x;i;:;]'a@&~(a:!10)in x@,/p i:x?0]} or 99 if using characters, e.g. x:"200370009009200007001004002050000800008000900006000040900100500800007600400089001" a:"c"$48+!10 f:{$[81=i:x?*a;,x;,/f'@[x;i;:;]'a@&~a in x@,/p i]} f x (we'd need a special k for stdin/stdout ..) a few more bytes with a greedy algorithm is one million times faster on some harder puzzles .. (30ms instead of 1 hour) \ > first pass is 88 bytes (on ints) > > p:+{(=x)x}'p,,3/:_(p:,/'+:\9#'!9)%3 > f:{$[&/x;,x;,/f'@[x;i;:;]'a@&~(a:!10)in x@,/p i:x?0]} now let's shorten this: f:{$[&/x;,x;,/f'@[x;i;:;]'&27=x[,/p i:x?0]?!10]} 83 .. except we have to deal with unix input/output. so maybe: p:+{(=x)x}'p,,3/:_(p:,/'+:\9#'!9)%3 *{$[&/x;,x;,/.z.s'@[x;i;:;]'&27=x[,/p i:x?0]?!10]}@.:'*.z.x 96 bytes incl newlines