Perhaps also worth noting:

   10&#.inv 1234
1 2 3 4
   10&#.inv 123456789
1 2 3 4 5 6 7 8 9
   10&#.inv 123456789012345678x
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8

Thanks,

-- 
Raul


On Fri, Dec 1, 2017 at 12:49 AM, Daniel Lyons <[email protected]> wrote:
> The problem statement has to do with summing up digits in a large number if 
> the digit matches the following digit, with wraparound.
>
> My concept is to take the input as an array of single-digit numbers, compare 
> this to itself rotated forward a digit. Wherever those match up, the 
> following digit is a match. I can then copy to select the values that match 
> and then simply sum them up. It works out like this:
>
>    NB. First I want digits, so:
>    a =. "."0 '<my big captcha string>'
>
>    NB. Part 1: the idea is to line up the input against itself, rotated right 
> one
>    +/ a #~ a = 1 |. a
>
> This worked, and then the twist in problem 2 turned out to be easy to 
> compensate for: instead of hard-coding 1, calculate half the length of the 
> array:
>
>    NB. Part 2: rotate by half the length
>    +/ a #~ a = (-: $ a) |. a
>
> I did not even try to define these as functions, since I was sure I'd lose 
> the plot trying to make them tacit and get frustrated.
>
> --
> Daniel Lyons
>
>
>
>
> ----------------------------------------------------------------------
> 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