As alwayshere are so many ways!  The following is based on the "inverse" of

   */"1 [ 0 1 2 +"1 0 i. 10
0 6 24 60 120 210 336 504 720 990

That is,

 {:@>@}.@p.@(,&2 3 1)@-  0 6 24 60 120 210 336 504 720 990
0
1
2
3
4
5
6
7
8
9

   u=. (= <.)@{:@>@}.@p.@(,&2 3 1)@-

   u 0 6 24 60 120 210 336 504 720 990
1
1
1
1
1
1
1
1
1
1

Another obfuscated way is via the inverse discrete Fourier transform but I
will pass on that one.

PS. I see Bo Jacobi got a similar idea 5 minutes ago (oh,well).



On Thu, Aug 6, 2015 at 1:58 PM, Kip Murray <[email protected]> wrote:

> The number  720  is  special: it is  8*9*10  the product of three
> successive non-negative integers.  The first few special numbers are
>
>     */"1 [ 0 1 2 +"1 0 i. 10
>  0 6 24 60 120 210 336 504 720 990
>
> Write a verb  test  that tests whether a non-negative integer is special:
>
>     test 720
>  1
>     test 0
>  1
>     test 721
>  0
>
> --Kip Murray
>
>
>
> --
> Sent from Gmail Mobile
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to