Not using cut here, but I took a generative approach:
ssd3=: 10#. [:~.[:,/(1 1 1 3 |."0 1~ i. 4) #"1/ (4#10)#: 1000+i.@9000"_
It basically starts from all 4 digit numbers, repeats each digit in turn,
then takes them all together and nubs it.
I guess it's fine if your definition considers 3 or more repetitions as
being fine.
I didn't double check all, but a quick random check seems to confirm the
outcome:
({~ 20 ?@$ #) ssd3 0
333975 956664 529777 947772 886661 811175 666289 622212 858777 637773
843999 488844 506662 267779 577728 111463 418444 861119 916333 722214
and it seems to run reasonably fast even on my phone:
30 timex 'ssd3 0'
0.020757
Best regards,
Jan-Pieter
On Sun, Jul 4, 2021, 05:53 Raul Miller <[email protected]> wrote:
> Oops, I should have replace i.9 1 with i.10 1
>
> $1e5+I.+./(3#"1":i.10 1) +./@E."1/ ":1e5+i.9e5 1
> 33219
>
> Sorry about that...
>
> --
> Raul
>
> On Sat, Jul 3, 2021 at 11:51 PM Raul Miller <[email protected]> wrote:
> >
> > You did not include a definition for triple here, and I have no way of
> > reproducing your result.
> >
> > This is a bit slower to execute (0.37 seconds on my laptop), but
> > faster to implement:
> >
> > $1e5+I.+./(3#"1":i.9 1) +./@E."1/ ":1e5+i.9e5 1
> > 29816
> > (12345+i.10){1e5+I.+./(3#"1":i.9 1) +./@E."1/ ":1e5+i.9e5 1
> > 444993 444994 444995 444996 444997 444998 444999 445000 445111 445222
> >
> > --
> > Raul
> >
> > On Sat, Jul 3, 2021 at 7:59 PM Julian Fondren <[email protected]>
> wrote:
> > >
> > > On Saturday, July 3rd, 2021 at 6:50 PM, Julian Fondren <
> [email protected]> wrote:
> > > > That takes about 80x as long as the attached method
> > > > using the FFI and a quick library in D.
> > >
> > > That attachment got stripped? Well, it's nothing special.
> > >
> > > extern(C) void triples(int* xs, int len) @nogc {
> > > foreach (i; 0 .. len)
> > > xs[i] = triple(xs[i]);
> > > }
> > >
> > > triplesd =: './libtriple.so triples n *i i'&cd
> > > triples =: [: triplesd (; #)
> > > triples 123334 122344 121212 111222 112122 555432
> > > +-+-----------+-+
> > > |0|1 0 0 1 0 1|6|
> > > +-+-----------+-+
> > > $(#~ triple"1) sn
> > > 33219 6
> > > $(#~ 1 {:: triples) n
> > > 33219
> > > 30 timex '$(#~ triple"1) sn'
> > > 0.869076
> > > 30 timex '$(#~ 1 {:: triples) n'
> > > 0.0100672
> > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm