Simplified Problem My question is a bit complex to be explained within the title, though what I'm truly looking for is an equation that can, as the title mentions, "express multiple values of x for only one value of n". to understand what I require i will provide a bit of background information about the use of this equation;
My Goal my goal is to (in short) make a picture out of string art by analyzing strings on a round wheel with pins. As to not waste time explaining it here, here is a video of the project im trying to recreate https://www.youtube.com/watch?v=WGccIFf6MF8&ab_channel=VirtuallyPassed
Problem Explained The main problem stems from the difficulty of efficiently picking out strings to test and analyze within a list of pre-analyzed strings. To allow my program to run faster, I am refraining from having any line re-analyzed (all lines possible are pre-analyzed prior to the start of drawing the picture). How i store each line's binary values is in a list ordered to the start of "n" in the equation (n(n-1))/2 down to the end of "n" where "n" is the number of nails. I want to know which line value to pull from this list to analyze and compare based on the current pin. Because a pin can only reach n-1 other nails and the order of the list is not in order of the leading pin (and can't be ordered as such for every pin at the same time), i wish to devise an equation that can select the correct values in the list all at once. It is possible to make several lists for each individual pin, though it would not be very effective the more pins i end adding. how would i do this?
Example As an example, in a 4 pin circle, there are 6 possible strings. from the first pin 3 lines can be drawn, from the second pin we can draw 2 lines, and from the third we can draw 1, which gives us a total of 6. from pin "1", we can trace lines; 1,2,3. from pin "2", we can trace lines; 1,4,5. from pin "3", we can trace lines; 5,2,6. and from pin "4", we can trace lines; 6,4,3. because the circle is relatively small you can do this by simple calculation, but now i need this "equation" to find the values from 1-6 for me.
Things I've Tried I've tried many things, but nothing of relevance here. i am not knowledgeable of anything that could solve this and have not much to go off of in my current understanding of math.
i have however attempted to re-order the list in terms of starting pins, but the list could not really fit all line orders from a starting pin. Another thing im attempting is to give the line values an address of which 2 pins they came from, though this would then make my program run around deciphering each line it draws. though i think its possible this could help if i find a more efficient method. but my main goal is to fit it all into one answer.
Does anybody know any math i should look into or has a direct answer they could give me?
It seems likely that a square 2D array / matrix would be the best data structure to store your computed values in. Granted, such an array has $n^2$ entries, and you only need ${n\choose 2}$, but this just means you will not compute or use the array on or below one of its diagonals. So e.g. if $A$ is your $n\times n$ matrix then $A_{jk}$ is not used whenever, say, $k\leq j$.
To collect all pre-computed values of lines that start or end at (say) point $7$, you will then want to look at both $A_{j7}$ (for $1\leq j<7$) and $A_{7k}$ (for $7<k\leq n$). This is respectively a partial column and a partial row of the matrix.
Almost every programming language has some efficient handling for matrix / array operations. For example Numpy in Python. But for that you are going to want to post on stackoverflow.