On Fri, Jun 4, 2010 at 7:31 AM, Roger Hui <[email protected]> wrote:
> j, m, and n are positive integers with m<n.
> Find a neat expression for all the odd multiples of j in [m,n),
> that is, all k such that (m<:k)*.(k<n)*.(1=2|k%j) .

   'j m n'=: 5 50 120
   range=: [+i.@:(0&>.)@:-~
   range/@:>.&.:(-:@:<:@:(%&j)) m,n
55 65 75 85 95 105 115

As you require m<n, you could omit the ((0&>.)@:) part.

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to