Skip et al.--
I have not closely followed all the various replies to the triple-digit 
challenge, but I haven't recognized any really direct approach to the solution. 
 Mine consists of:
--Format each number as a row of characters
--Shift (not rotate) each row twice relative to itself
--Drop the two columns of partial overlap at each end
--Take the Nub of each 3-element column so generated
--Find each group containing a nub of size 1
--Select the corresponding original numbers

It took me a few days to co-ordinate all the proper operations, ranks, and 
transposes.  Here's the test:

   vals=. 123334 122344 121212 111222 112122 555432
   ((1 e."1 [:{.@$@~."1 (1)|: 2}."1 (_2)}."1 (1 0 2)|: (0 1 2)|."0 1/ '  ',"1 
":"0@]) #]) vals
123334 111222 555432
--Art

On Sat, 3 Jul 2021 18:13:15 -0500, Skip Cave <[email protected]> wrote:
Can I use cut to find all the 6-digit integers that have three consecutive
identical digits? Or is there a more efficient way?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to