On 01-06-13 13:48, Olivier N. wrote:
First, I understand I was unclear when stating my own goal:
I try to create a closed form solution, without the use of
any +/ summation and the likes.

correct!, telz isn't.


Here's an algebraic solution:

telz=: 3 :0
zx=. <.-:y
zm=. 1+<.y%3
+/>.-:(1&{-y-+/) (,:<:)zm+i.1+zx-zm
)
It seems that your solution does not respect the "zmax < -:y" asked by the OP. 
Eg. triangle-count(6) should be zero.

correct again!

--
Met vriendelijke groet,
@@i = Arie Groeneveld

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

Reply via email to