Re: [Jprogramming] Truncating primes

2022-11-20 Thread 'Pascal Jasmin' via Programming
based on Raul's rosettacode link, but building an expaning list of left truncable primes, such that further search is possible on future "iterations"  selPrime=: #~ 1&p: ltrunc =: (] , ((1+i.9) (10 #. ,)"0 1 (10&#.inv))"0(,@:)(selPrime@:) each@:{:) # &> sofar =: ltrunc^:6 < 3 7x 2 11 39 99 19

Re: [Jprogramming] Truncating primes

2022-11-20 Thread Raul Miller
On Sun, Nov 20, 2022 at 12:29 PM Richard Donovan wrote: > I guess I was expecting ‘match’ -: to be an exact compare including data type! Yes, with numbers it's just reporting numeric equality. 1=1 regardless of whether it's 1 apple, or 1 on the complex plane. I guess you might use -:&(;datatype)

Re: [Jprogramming] Truncating primes

2022-11-20 Thread Richard Donovan
Thanks Raul. Heavy stuff indeed. I guess I was expecting ‘match’ -: to be an exact compare including data type! > On 20 Nov 2022, at 14:58, Raul Miller wrote: > >  digitsE=:10&#.^:_1 NB. Elijah's convert to digits > digitsR=:"."0":NB. My convert to digits > datatype digitsE 357686

Re: [Jprogramming] Truncating primes

2022-11-20 Thread Raul Miller
digitsE=:10&#.^:_1 NB. Elijah's convert to digits digitsR=:"."0":NB. My convert to digits datatype digitsE 357686312646216567629137x extended datatype digitsR 357686312646216567629137x floating truncs=. [:~. [:10x&#.\. digitsR truncs 357686312646216567629137x 3.57686e23 5.7686

Re: [Jprogramming] Truncating primes

2022-11-20 Thread Richard Donovan
Proving that I am still baffled by J! Elijah has a different way to convert a number to its digits than I normally use, so I set out to compare.. digitsE=:10&#.^:_1 NB. Elijah's convert to digits digitsR=:"."0":NB. My convert to digits (digitsE-:digitsR) 357686312646216567629137x 1NB.