# How to find the original value based on modulus/reminder and some other information [closed]

This might be a very basic question in terms of math,

x % constant = x_modulus

(x + some_number) % constant = y_modulus


Given the value of x_modulus, y_modulus, (x + some_number) and constant(common in both), output the value of x itself based on these values.

• Are you asking this question because you don't know, or because you want us to write programs that will input these numbers and output x? – Wezl May 4 at 14:16
• I am asking becase I really don't know in terms of math, how to correlate all these values together. I don't want the complete program, just rough steps would be enough. – Tejas Sarade May 4 at 14:19
• Then maybe you should post this on the math stackexchange, where you will be very likely to get an answer. On code golf, you would get answers of short programs that could solve your problem but not always direct answers. See why this question was closed. – Wezl May 4 at 14:23
• Just as a side note, the value of some_number is the absolute difference between x_modulus and y_modulus, which is in turn x's distance with the closest multiple of constant larger than x. Therefore it's impossible to find what exactly is the value of x. That greatly simplifies the question. – user92069 May 4 at 14:28

# 05AB1E, 1 byte

Finds the smallest possible value of all values of x, takes input as some_number, constant, x_modulus, y_modulus

α


Try it online!

## Explanation

Here are my observations:

• The value of some_number is the absolute difference between x_modulus and y_modulus

• The above value is in turn x's distance with the closest multiple of constant larger than x.

Therefore it's impossible to find what exactly is the value of x. That greatly trivializes the question into a simple absolute difference between some_number and constant.

The code itself is just absolute difference, I don't feel like explaining it. :D

• What does this do? :) – the default. May 4 at 14:34
• @mypronounismonicareinstate This solves the question. :) – user92069 May 4 at 14:41