Re: [Jprogramming] Question about ^:

2019-07-20 Thread Henry Rich
The key is that the operation (x u^:v y) is a dyad, so both arguments go to both u and v.  The function of ] [ is to DISCARD an unwanted argument. x stuff@] y   is the same as   stuff y x stuff@[ y   is the same as   stuff x Thus x stuff@] ^: [ y   is (x&(stuff@])) ^: (x [ y) y  is (stuff ^: x

Re: [Jprogramming] Question about ^:

2019-07-20 Thread The3DSquare jOsHUa
Thanks Henry and Linda I came up with this: fib =: (,+/@(_2 _1&{))@]^:[&0 1 fib 8 0 1 1 2 3 5 8 13 21 34 ...which works quite well. With some rearranging, I got the two inputs on the right hand side to switch after looking at Henry's suggestion. Also, would you mind explaining the *]^:[* in

Re: [Jprogramming] Question about ^:

2019-07-20 Thread Linda Alvord
Interesting! newfib=: 13 :' }:}.(,[:+/_2&{.) ^: y (0 1)' newfib 10 1 1 2 3 5 8 13 21 34 55 Linda -Original Message- From: Programming On Behalf Of The3DSquare jOsHUa Sent: Saturday, July 20, 2019 6:11 PM To: programm...@jsoftware.com Subject: [Jprogramming] Question about

Re: [Jprogramming] Question about ^:

2019-07-20 Thread Henry Rich
I don't think so, but I can offer    4 (,[:+/_2&{.)@]  ^:[ 0 1 0 1 1 2 3 5 Henry Rich On 7/20/2019 6:11 PM, The3DSquare jOsHUa wrote: Hello, I'm new to this forum. However, I have a quick question. The conjugation ^: is represented as u ^: n y. Is there any way to make it like u ^: y n? Ie. T

[Jprogramming] Question about ^:

2019-07-20 Thread The3DSquare jOsHUa
Hello, I'm new to this forum. However, I have a quick question. The conjugation ^: is represented as u ^: n y. Is there any way to make it like u ^: y n? Ie. Turning this: (,[:+/_2&{.) ^: 4 (0 1) into this: (,[:+/_2&{.) ^: (0 1) 4 So essentially, swapping the two right-hand inputs for ^:. Than

Re: [Jprogramming] newbie question about indexing/tabling

2019-07-20 Thread 'Mike Day' via Programming
At long last - I've only just managed to find some further solutions! I generate triples of P5s, such that P5(a) + P5(b) = P5(c) for triple (a,b,c) and check for which of them P5(d) = P5(a) + P5(c) for an integer d: |:Ptriples 30 4 7 12 19 7 23 22 22 8 24 25 29 Here are some timings on my la

Re: [Jprogramming] Fibonacci Encoding

2019-07-20 Thread 'Mike Day' via Programming
FWIW, here’s my code for changing back to decimal representation. z2d =: 3 : 0 if. _1 < <./ y do. +/ #/ y join Fb else. +/ */ y join Fb end. ) join =: 3 : 0 join/ y : l =. - ({:@$x) >. {:@$y r =. (l{."1 x),: l{."1 y if. 2<#$r do. (l{."1 x), l{."1 y end. ) eg d2z 100 1 0 0 0 0 1

Re: [Jprogramming] Program to replicate Ramanujan's methods

2019-07-20 Thread R.E. Boss
http://www.ramanujanmachine.com R.E. Boss > -Oorspronkelijk bericht- > Van: Programming > Namens Devon McCormick > Verzonden: vrijdag 19 juli 2019 16:41 > Aan: J-programming forum > Onderwerp: [Jprogramming] Program to replicate Ramanujan's methods > > Fellow Jedi - > > There's a Ne

Re: [Jprogramming] Fibonacci Encoding

2019-07-20 Thread 'Jon Hough' via Programming
"In other words, it's not the fibonacci part that's the problem for me, it's whatever you are using to convert to ascii that's the problem. (Note also that there's no need to add any 1s into the represented result - you just terminate the sequence by eliminating what would be trailing ascii nul c

Re: [Jprogramming] Fibonacci Encoding

2019-07-20 Thread 'Jon Hough' via Programming
"You mention the possibility of 1 1 1 appearing in an encode result and that making decode awkward without a loop. My guess is that that can happen if you encode multiple numbers into a single result where two adjacent encodings produce the 1 1 1. Is that right?" This is correct. Simplest exampl