I went for append after all.
Here's a little script:
NB. list of invertible digits - could perhaps include 2, 5
digs =: 0 1 6 8 9 NB. or 0 1 2 5 6 8 9
NB. indices of "inverses"
ix =: 0 1 4 3 2 NB. or 0 1 3 2 6 5 4
NB. drop leading zeros
dlz =: }.~ (=&0 (i.) 0:)
NB. construct 1 lis
Not J as such, but one might consider including 2 & 5, which are also
"upside-downable"-ish, partly depending on the font.
Have you considered a constructive approach?
Eg take any number with only u-d digits possibly starting 0 in but not ending
in 0;
prepend the rotations of the reverse
Thanks Pascal, Raul et al
For context, a friend just celebrated his 69th birthday and I noted this age
reads the same either way up. For practice i wanted to write a J function that
outputs all such possible numbers!
I am starting by finding all candidate numbers (those having only digits 0 1
Yes Thomas you are correct, it was my typo. The definition is correct. the
result was mistyped!
Thanks
Richard
From: Programming on behalf of
Thomas Bulka
Sent: 26 August 2023 12:54
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] integers occur in i
Thanks Pascal, that works perfectly!
Richard
From: Programming on behalf of
'Pascal Jasmin' via Programming
Sent: 26 August 2023 13:21
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] integers occur in integers?
3 2 1(*./@:(e.~)&~.&(/:~) 10. inv)("
Yes... using rank 1 0 on the implementation is a good alternative to
boxing. Using the approach I had come up with (I have not done any
benchmarking here), this could be:
3 2 1((0 = #@-.~) 10. inv)("1 0) 230 123 111 123123132
0 1 1 1
--
Raul
On Sat, Aug 26, 2023 at 8:30 AM 'Pascal Jasmin'
3 2 1(*./@:(e.~)&~.&(/:~) 10. inv)("1 0) 230 123 111 123123132
0 1 1 1
On Saturday, August 26, 2023 at 06:31:01 a.m. EDT, Richard Donovan
wrote:
I am trying to find out whether a series of integers y only contain a set of
integers x
That is, 1 3 5 verb 5311 10531 536
I think you should change your description to
"I am trying to find out which integers in y contain no other digits than x"
I am also going to imagine that Thomas Bulka's proposed result is correct here.
Experimenting with this, one of the issues is efficiency and 0 as a
digit. Since 0 is used fo
Richard Donovan writes:
> I am trying to find out whether a series of integers y only contain a set of
> integers x
>
> That is,1 3 5 verb 5311 10531 536 111
> should return 1 0 1 1
>
>NB. only 1 3 5 occur in 5311
>NB. not only 1 3 5 occur in 10531
>NB. not only 1 3 5
I am trying to find out whether a series of integers y only contain a set of
integers x
That is,1 3 5 verb 5311 10531 536 111
should return 1 0 1 1
NB. only 1 3 5 occur in 5311
NB. not only 1 3 5 occur in 10531
NB. not only 1 3 5 occur in 536
NB. only 1 3 5 occur in 11
10 matches
Mail list logo