On 21-03-13 21:24, David Ward Lambert wrote:
lucky =: 3 : 0 NB. make lucky numbers from 1 to doubled y
A =. >: +: i. y
N =. 1
M =. 1
while. M (< #) A do.
M =. N { A
A =. ((#A) $ -. (-M) {. 1) # A
N =. >: N
end.
A
)
Here's an almost exact translation to a tacit form. Meaning it also uses
the iterator N and your ingenious sieve (I like that one).
sieve=: [#~#@[$ -@] -.@:{.1:
lucky=: 1 {:: [: (>:@[;]sieve {)&>/^:(({< #@])&>/)^:_ 1: ;1+2*i.
... and using Raul's remark:
And, 2: is a verb word. I do not need any extra syntax
to convey to the interpreter that _ 2: is two separate words.
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm