On Mon, Dec 1, 2008 at 2:47 PM, Ian Gorse <[EMAIL PROTECTED]> wrote:
> t2=: +/ =&[EMAIL PROTECTED] i.
This is a fork, the following are equivalent:
t2 7
(+/ =&[EMAIL PROTECTED] i.) 7
(+/ 7) =&[EMAIL PROTECTED] (i. 7)
7 =&[EMAIL PROTECTED] i. 7
0 1 1 1 1 1 1
> t3=: [: +/ +/ =&[EMAIL PROTECTED] i. NB. Correct answer, but performed trial
> and error
Another approach would be:
[: +/ ] =&[EMAIL PROTECTED] i.
or
+/@:=&1@(+. i.)
Also, note that when learning J's tacit syntax, 13 : is your friend:
If you can come up with an expression that works, you can
replace its argument with y and try 13 : and see how it
approaches the problem.
That said, note that I am focusing on J issus, and not
on euler's totient function. Roger Hui's message deals
with that issue.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm