I have only worked on part 1 so far. All my verbs are monadic and take the number in question as its argument.
evenQ =. = <.&.-: size =. (+evenQ)@>.@%: NB. edge length border =. size-&*:_2+size NB. border length (number) lowest =. 1 _3 4& p. @ -:@<:@size NB. border's number which needs lowest # of moves least4 =. lowest+ (i. 4)*4%~border NB. border's 4 lowest # of moves least =. -:@<:@size NB. least # of moves addto =: least4<./@:(|@-)] NB. additional # of moves total =. least + addto total"0]1 12 23 1024 0 3 2 31 I found the polynomial in `lowest` by studying the pattern of numbers 1 2 11 28 53 as follows. (The fact that the 2nd differences are constantly 8 lead me to the solution.) 2-/\(^: 0 1 2)1 _3 4 p. i. 5 1 2 11 28 53 _1 _9 _17 _25 0 8 8 8 0 0 I had seen Eugene's evolute and now WRAP, so maybe the second part is doable, but I'm tired. -- (B=) <-----my sig Brian Schott ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
