A direct solution without the assumption that the solution is a whole number

.

.

.

(-/ .* % -/ .+)@:(2 2&$) 21 38 55 106 4



On Tue, Aug 14, 2018 at 1:37 PM, Jose Mario Quintana <
jose.mario.quint...@gmail.com> wrote:

> A brute-force approach assuming that the solution is a whole number, and I
> am understanding the problem correctly, follows after a few blank lines...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>    ((0 = -/ .*@:(2 2$21 38 55 106 - ])"0) # ]) i.111
> 4
>
> Checking,
>
>    -/ .* (2 2$21 38 55 106 - 4)
> 0
>
> Indeed, 17 is a common factor.  Actually,
>
>    +./ 21 38 55 106 - 4
> 17
>
> On Tue, Aug 14, 2018 at 2:07 AM, Skip Cave <s...@caveconsulting.com>
> wrote:
>
>> Attempting to solve the following Quora problem:
>>
>> What number must be subtracted from 21, 38, 55, and 106 each so that the
>> remainders (technically differences) are proportional?
>>
>> Subtract the integers 0-9 from all four integers in the problem. Then find
>> the prime factors of each set of four integers. Finally look for columns
>> that have common factors in all four results:
>>
>> ]b=.q: each 21 38 55 106-/a=.i.10
>>
>> ┌────┬───────┬────────┬──────┬──────┬───────┬─────────┬─────
>> ────┬─────┬─────┐
>>
>> │3 7 │2 2 5 │19 │2 3 3 │17 │2 2 2 2│3 5 │2 7 │13 │2 2 3│
>>
>> ├────┼───────┼────────┼──────┼──────┼───────┼─────────┼─────
>> ────┼─────┼─────┤
>>
>> │2 19│37 │2 2 3 3 │5 7 │2 17 │3 11 │2 2 2 2 2│31 │2 3 5│29 │
>>
>> ├────┼───────┼────────┼──────┼──────┼───────┼─────────┼─────
>> ────┼─────┼─────┤
>>
>> │5 11│2 3 3 3│53 │2 2 13│3 17 │2 5 5 │7 7 │2 2 2 2 3│47 │2 23 │
>>
>> ├────┼───────┼────────┼──────┼──────┼───────┼─────────┼─────
>> ────┼─────┼─────┤
>>
>> │2 53│3 5 7 │2 2 2 13│103 │2 3 17│101 │2 2 5 5 │3 3 11 │2 7 7│97 │
>>
>> └────┴───────┴────────┴──────┴──────┴───────┴─────────┴─────
>> ────┴─────┴─────┘
>>
>>
>> Now how can I write a J function that lists the column index in this array
>> where all four sets of factors have at least one common factor?  Spoiler -
>> In the example, the 5th set (column index 4) has a common factor of 17.
>>
>>
>> Skip
>>
>>
>> Skip Cave
>> Cave Consulting LLC
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to