> I do not see any attempt in the question at generalizing—so technically the > answer would be a number.
In addition, that number presumably should be a function of the four numbers; as far as I can see, that function can be defined as the verb, v=. (-/ .* % -/ .+)@:(2 2&$) So, v 21 38 55 106 4 In the Quora page, there are "Related Questions" and the answers to those questions according to v are, v 41 56 36 48 16 v 18 78 19 83 3 v 23 30 57 78 6 > But I expect that easy to describe (but accurate) general approaches would > fit right in... All the numbers (and the answers) in the examples above are positive integers; however, v still seems to work fine when they are not; for example, v 23 30 57 78 + 0.5 6.5 v 23 30 57 78 * 0.5 3 v %: 23 30 57 78 1.67100218 v %: 23 30 , - 57 78 0.610353598j_0.324426817 v 4j5 5j6 3j5 3j6 3j4 Moreover, v produces an answer when there are a lot of possible answers (in principle, a continuum), v 1 2 1 2 0 including, a "limit" answer when there is no (conventional) answer, v 2 4 0 2 _ v 1 2 3 4 j. 5 6 7 8 0j_ On Tue, Aug 14, 2018 at 7:42 PM, Raul Miller <rauldmil...@gmail.com> wrote: > I do not see any attempt in the question at generalizing—so technically the > answer would be a number. > > But I expect that easy to describe (but accurate) general approaches would > fit right in... > > Thanks, > > — > Raul > > On Tuesday, August 14, 2018, Jose Mario Quintana < > jose.mario.quint...@gmail.com> wrote: > > > After I saw your message I searched for the particular Quora problem and > > this is what I found, > > > > https://www.quora.com/What-number-must-be-subtracted- > > from-21-38-55-and-106-each-so-that-the-remainders- > > technically-differences-are-proportional > > > > It seems to me that the shape of the array is restricted to be exactly 4 > > and the numbers do not have to be integers. Am I wrong? > > > > > > On Tue, Aug 14, 2018 at 7:00 PM, 'Mike Day' via Programming < > > programm...@jsoftware.com> wrote: > > > > > It should work on arrays of the form > > > a + b * i, where a and b are integer scalars, and i is an integer > > > vector. > > > So, if > > > q=: 6 + 7*1 2 5 11 23, > > > applying this function yields > > > (-/ .* % -/ .+)@:(2 2&$) q > > > 7.4 > > > I think you need instead something like > > > Difference’s greatest common divisor, > > > dgcd =: +./@:(2 -~/\ ]) > > > So > > > dgcd q > > > 7 > > > > > > It’s a bit more complicated to recover the factors, 1 2 5 ..., which > seem > > > to be required in the Quora problem: > > > (](([-|~)%])dgcd) q > > > 1 2 5 11 23 > > > This works for the original array, too, > > > (](([-|~)%])dgcd) 21 38 55 106 > > > 1 2 3 6 > > > > > > And > > > dgcd 21 38 55 106 > > > 17 > > > > > > Sorry for any formatting problems - typing on iPad, > > > > > > Mike > > > > > > > > > Please reply to mike_liz....@tiscali.co.uk. > > > Sent from my iPad > > > > > > > On 14 Aug 2018, at 23:18, Jose Mario Quintana < > > > jose.mario.quint...@gmail.com> wrote: > > > > > > > > (-/ .* % -/ .+)@:(2 2&$)21 38 55 106 > > > ---------------------------------------------------------------------- > > > 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm