I would like to define this parameter inside a function:

$R = \min\left\lbrace i \in \left\lbrace 1,\cdots,n \right\rbrace \; : \; ((p+i)\mod n) \; \neq a_{j} \; \forall j \in \left\lbrace 1,\cdots,m \right\rbrace \right\rbrace$

My function is:

f[x__] := Mod[x[[m + 1]] + R, n]

where x is the list:

x = {a1,a2,...,am,p}

Both $m$ and $n$ are given numbers.

I think I could use Pick or something similar but haven't been able to crack it. Hope you can help me guys.

| improve this question | | | | |

Your Answer

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

Browse other questions tagged or ask your own question.