A less brutish approach:
] v=: i.6
0 1 2 3 4 5
10 #. (5=+/"1 t)#t=: >,{v;v;v
5 14 23 32 41 50 104 113 122 131 140 203 212 221 230 302 311 320 401 410 500
Tacit version:
f=: 10&#. @ (] #~ 5 = +/"1) @ (>@,@{@(3&$)@<) @ i.@>:
f 5
5 14 23 32 41 50 104 113 122 131 140 203 212 221 230 302 311 320 401 410 500
Tacit with components:
select=: ] #~ 5 = +/"1
all =: >@,@{@(3&$)@<
start =: i.@>:
f1 =: 10&#. @ select @ all @ start
f1 5
5 14 23 32 41 50 104 113 122 131 140 203 212 221 230 302 311 320 401 410 500
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm