There seems to be a typo in Roger's solution; 

    +/ <.@(%&2)@<: n - 3*i.<.n-3 [ n=: 1e2
_2207

The last '-' in the line should be division, '%'

   +/ <.@(%&2)@<: n - 3*i.<.n%3 [ n=: 1e2
883
   +/ <.@(%&2)@<: n - 3*i.<.n%3 [ n=: 1e4
8333333
   +/ <.@(%&2)@<: n - 3*i.<.n%3 [ n=: 1e6
83333333333

Which explains the otherwise unnecessary '<.' in the first part. Roger's
solution can also be made slightly more terse:

   +/ <. -: 3 * >: i. <. 3 %~ 1e6
83333333333

[2018-05-20 13:41] 
>
> part       text/plain                5214
> Raul, I can follow most of your solution, and it looks right. What is
> bothering me is that I cut & pasted Roger's solution into my JQt and got a
> different answer:
> ...
> Why are my answers so different from Roger's?
> 
> Engine: j807 /j64/windows Beta-c: commercial/2018-03-13T17:40:01 Library:
> 8.07.09 Qt IDE: 1.7.1/5.9.4 Platform: Win 64
> 
> Skip
> 
> 

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

Reply via email to