Randy MacDonald writes: > This is why I test first. A simple example would have washed out my > off-by-ones.
I don't know what you tested, but your proposed expression gives the wrong (or, at least, incomplete) answers whereas my original expression gives the correct answers: Original problem: http://xkcd.com/287/ a=: 215 275 335 355 420 580 ord=: 3 : 0 b=. 1505 = ((#: i.@(*/)) y) +/ .* a z=. y #: I. b assert. 1505 = z +/ .* a ) ord >. 1505 % a NB. MacDonald 1 0 0 2 0 1 ord 1 + <. 1505 % a NB. Hui 1 0 0 2 0 1 7 0 0 0 0 0 1505 % a 7 5.47273 4.49254 4.23944 3.58333 2.59483 >. 1505 % a 7 6 5 5 4 3 1 + <. 1505 % a 8 6 5 5 4 3 Even if no element of a divides m so that >.m%a is equivalent to 1+<.m%a , I would not have used the first expression. I might have considered <.(1+m)%a . ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
