Simple discrete math question

105 Views Asked by At

It's been a long time since I took discrete math in college and I was never good at it, so I'm asking for some help with something I need to populate a chart in C#.

X = 2, the output for 2 is 0, and with each iteration the input increases by 3 and the output increases by 1.

input | output
______|_______
  2   |   0
______|_______
  5   |   1
______|_______
  8   |   2

and so on. I tried finding a value for a for input % a = output but didn't come up with anything. I feel like this is a simple problem but it just isn't my thing. Is there a function that given an input will give me the proper output? I need this to work, like if I put in 23 I need to get 7 without knowing that 20 was 6.

1

There are 1 best solutions below

1
On BEST ANSWER

Try $$f(x) = \frac{x-2}{3}$$ and plug input for $x$, then $f(x)$ will return output.