> From: Aai
>
> sigma(n) is just the sum of the divisors +/divs
>
> This was my first approach of sigmaTest:
>
> sigmtest=: 4 : 0
> if. 0=x do. 1 return. end.
> if. 0=#y do. 0 return. end.
> if. x < {.y do. x sigmtest }.y
> else. ((x-{.y) sigmtest }.y ) +. x sigmtest }.y end.
> )
>
> This 'exact' translation makes it probably much slower.
>
If you want, you can eliminate most of double recursion by using short scheme
for +.
Something along the lines of
sigmtest=: 4 : 0
if. 0=x do. 1
elseif. 0=#y do. 0
elseif. x < {.y do. x sigmtest }.y
elseif. ((x-{.y) sigmtest }.y ) do. 1
elseif. 1 do. x sigmtest }.y
end.
)
What is the target number you want apply it to?
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390707/direct/01/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm