To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.
timespacex '5 #.^:_1&.> i.100000' NB. Yours
0.694979 4.69305e8
Here, I tried to do the same + filtering; it still costs less:
pf =: (#~ (-:|.)"1) NB. guessing this is what you want to do.
timespacex 'pf ,"2 ":"(0) 5 #.inv i.100000'
0.11806 9.44435e6
Maurice
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.
On 2 Sep 2024, at 21:28, Raul Miller <rauld...@gmail.com> wrote:
It might be that the suggestions you've received are good enough for
0.000277 67296
timespacex'5 psa 8' NB. space much the same!
0.0001156 67424
(The theme here continued to be boxless.)
more seriously,
bn =: <.@(1: + (^. >./))
bdl =: ] #:~ bn # [
NB. the table of 0-padded digits in base 5; similar to Henry's.
5 bdl i.100000
NB. leading zero aware palindrome check and tell you which one. Did I get it right?
dr =: 1 i."1~ 0&<
bpldm =: 4 : '(#~ ([: ((-:|.)"1 (|."(0 1)~ dr)) x&bdl)) y'
On Wednesday, September 4, 2024, 11:39 AM, fo...@jsoftware.com wrote:
Mike Day <mike_l...@tiscali.co.uk>: Sep 03 06:10PM +0100
Michael Day <mike_l...@tiscali.co.uk>: Sep 03 07:06PM +0100
Actually it's not much more complicated when avoiding any pruning of
the rhs of the candidate palindromes:
cf my earlier email - below this one -
psa =: {{
b =. x NB. base
d =. y NB. width
hd=. >.-: d NB. size of rhs (incl
middle if d odd)
bb=. (1,~<: hd) # b - 0 1 NB. using b-1 in units column
i =. (1 {.~ - hd) +"1 bb #: i. */bb NB. generate rhs,
incrementing units column to avoid zeros
10 #. i,. ~ (d-hd){."1|."1 i NB. pin on the lhs; result is expressed in
base 10
}}
timespacex'5 ps 8' NB. on my laptop this time
0.000277 67296
timespacex'5 psa 8' NB. space much the same!
0.0001156 67424
(6!:2 , 7!:2)'(#: i.@(*/)) 8$5' NB. Henry's scoping snapshot
on my laptop
0.0186664 3.35563e7
On 03/09/2024 18:10, 'Mike Day' via forum wrote:
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
bill lam <bbil...@gmail.com>: Sep 04 12:21AM +0800
That should be a bug in J9.6 beta 3 and later.
It should be already fixed in beta 17.
On Sat, Aug 10, 2024, 11:28 PM Jan-Pieter Jacobs <janpiete...@gmail.com>
wrote:
Jan-Pieter Jacobs <janpiete...@gmail.com>: Sep 03 07:37PM +0200
Thank you Bill,
I tried and confirm installing from Github now works.
Jan-Pieter
Marcin Żołek <marcin...@students.mimuw.edu.pl>: Sep 03 05:44PM +0200
Thanks! I find your approach (get the indices of elements for each diagonal and then work with flattened array) very useful and universal. I came up with a less universal approach: find pairs of local indices for each diagonal and then map them to the correct indices. Your solution seems more universal to me, because finding pairs is independent of the fact that the task involved diagonals in your case, while in my case it is dependent.
a =: 4 4 $ 1 0 1 1 2 2 1 1 1 2 0 1 2 0 2 2
((I.@:(=&1) <@:(,/)@:(,."0 1) I.@:(=&2))/. ;@:({&.>) </.@:i.@:$)"2 a
2 5
8 5
3 9
3 12
6 9
6 12
11 14
Marcin
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to forum+un...@jsoftware.com.