Thanks, Roger; I suspected Base (#.) was involved; I just didn't think of 
taking its inverse.

Interestingly, although the solution using Base seems closer to the content of 
the problem -- keeping things in the realm of integers instead of going back 
and forth to and from strings -- on my system with J8.01, the approach using 
strings is roughly 3 times slower and uses roughly 3 times as much space.

On Fri, 7 Mar 2014 14:15:39 -0800, Roger Hui <rogerhui.can...@gmail.com> wrote:

> ...
>  10&#.^:_1 x converts a number to its decimal digits.  Alternatively,
> "."0":x would be shorter than what's on the video.  But we quibble.
> 
>   10&#.^:_1 ]!100x
> 9 3 3 2 6 2 1 5 4 4 3 9 4 4 1 5 2 6 8 1 6 9 9 2 3 8 8 5 6 2 6 6 7 0 0 4 9 0
> ...
>   "."0": !100x
> 9 3 3 2 6 2 1 5 4 4 3 9 4 4 1 5 2 6 8 1 6 9 9 2 3 8 8 5 6 2 6 6 7 0 0 4 9 0
> ...

——
Murray Eisenberg                     mur...@math.umass.edu
Mathematics & Statistics Dept.       
Lederle Graduate Research Tower      phone 240 246-7240 (H)
University of Massachusetts                
710 North Pleasant Street                 
Amherst, MA 01003-9305






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

Reply via email to