0
$\begingroup$

Consider a list of numbers:

list = {1,2,3,4,5};

Taking a random set of three of these numbers:

{n1, n2, n3} = RandomSample[list, 3] // Sort

{1, 3, 4}

I would like to determine general coefficients a1,a2,a3 and b1,b2,b3:

n4 = Mod[a1 n1 + a2 n2 + a3 n3 , 5, 1] ;
n5 = Mod[b1 n1 + b2 n2 + b3 n3 , 5, 1] ;

such that n4 and n5 are set to the remaining two numbers, not appearing in {n1, n2, n3}, in increasing order. So, for the example above we should have:

{n4, n5}

{2, 5}

Is there a way to use Mathematica to solve for the unknowns a1,a2,a3 and b1,b2,b3, or determine if no such solution exists? Thanks for any suggestion!

$\endgroup$
  • $\begingroup$ For your example, you could do FindInstance[{a1 + 3 a2 + 4 a3 == 2, b1 + 3 b2 + 4 b3 == 5}, {a1, a2, a3, b1, b2, b3}, Modulus -> 5] $\endgroup$ – Carl Woll Jun 17 '17 at 3:32
  • $\begingroup$ @CarlWoll Yes, but my problem is that I need a closed form solution. By brute forcing I just noticed that no solution seems to exist in a sensible range of coefficient values. Trying to add more coefficients and higher powers of ni now. $\endgroup$ – Kagaratsch Jun 17 '17 at 3:36
1
$\begingroup$

You can do this specific example with brute force, e.g.:

su = Subsets[Range[5], {3}];
tu = Tuples[su, 2];
fun[x_] := 
 Pick[tu, (Mod[#.x, 5, 1] == Complement[Range[5], x] & /@ tu)]
Column[Table[j -> MatrixForm /@ fun[j], {j, su}]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.