1
$\begingroup$

I'm having a bit of trouble puzzling a formula for some code I'm using to develop a piece of software. I'm not very savvy with what the technical terms for all of what I'm describing are, but I'll try to be thorough in my explanation.

x and y need to be put into a formula that equals 100, and can be used as many times in the formula as necessary

x and y have multiple values

the values of x and y are paired, so they need to be in order. You can't take the fifth x value and use it with the third y value.

the x values are, in order, 10, 20, 25, 30, 40, 50, 55, 60, 75

the y values are, in order, 1, 2, 3, 4, 5, 6, 7, 8, 9

For example, x = 20 would pair with y = 2.

So far, I've been trying 10(x/y) + (15 - y), but that's rather stupid now that I think about it. With x = 20 and y = 2, the answer would be 113, whereas with x = 75 and y = 9, the answer is 89.

The answer to all nine pairs of variables needs to total 100. I've been doing these sorts of formulas all day but this is the first one I've had trouble with... maybe because my brain is fried. But I would dearly appreciate the answer soon, otherwise I would've been content to stop working for the day and unclog my mind.

If anyone could offer assistance or even lead me in the right direction to solving this quandary, I would be very thankful.

$\endgroup$
  • 1
    $\begingroup$ You need to have some more requirements -- at present the constant formula 100 satisfies everything you have specified. $\endgroup$ – Henning Makholm May 24 '15 at 0:23
  • $\begingroup$ "at present the constant formula 100 satisfies everything you have specified" Hi Henning, thank you for answering. I'm not sure what you mean by this. I need to arrange the x and y variables into a formula that equals 100, I am asking the question because I do not know how to do that. $\endgroup$ – ryanindustries May 24 '15 at 0:26
  • $\begingroup$ x @ryan: What I'm saying that the function that always returns 100 no matter what $x$ and $y$ are satisfies everything you have required so far. If you want $x$ and $y$ to appear textually in the expression, you can write 100+0*x+0*y. If that does not satisfy your purpose, it must be because there is something you have not told in the question. Are there some input values where you want the result to be different from 100? Which inputs are that, and which output do you want there? $\endgroup$ – Henning Makholm May 24 '15 at 0:34
  • $\begingroup$ Now that I think about it, yes. If x exceeds one of the values while matched with y, for instance, if x = 20 and y =2 are paired, and x = 25, the number should be above 100 to reflect with the formula. But should never be below 100. $\endgroup$ – ryanindustries May 24 '15 at 1:33
  • $\begingroup$ And what if $x$ is too small to match the $y$? $\endgroup$ – Henning Makholm May 24 '15 at 1:35

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.