RosettaCodeData/Task/N-smooth-numbers/J/n-smooth-numbers.j
2023-07-01 13:44:08 -04:00

10 lines
256 B
Text

nsmooth=: dyad define NB. TALLY nsmooth N
factors=. x: i.@:>:&.:(p:inv) y
smoothies=. , 1x
result=. , i. 0x
while. x > # result do.
mn =. {. smoothies
smoothies =. ({.~ (x <. #)) ~. /:~ (}. smoothies) , mn * factors
result=. result , mn
end.
)