Neat.  Thanks for the note.


----- Original Message -----
From: Andrew Nikitin <[email protected]>
Date: Tuesday, November 3, 2009 13:02
Subject: [Jprogramming] totient
To: J programming <[email protected]>

> 
> I came up with cute expression for totient, which in addition to 
> being cute, also seems faster than 5&p. (in j601)
> 
> Here it is:
> 
>    tot=:(- ~:)&.q:
> 
>    (5&p: -: tot) 2+i.100000x
> 1
> 
> 
>    6!:2 '5 p: 2+i.100000x'
> 2.51881
>    6!:2 '(- ~:)&.q: 2+i.100000x'
> 0.676987
>    6!:2 '5 p: 2+i.100000'
> 0.409061
>    6!:2 '(- ~:)&.q: 2+i.100000'
> 0.195733
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to