[Undergrad calculus] Least common multiple of numbers if each number are change the final result?

Are you trying to find the common multiples for each pair of numbers between 2 and n?

No no, I am trying to find common multiples for given numbers - for example 3, 6, 4 (lcm = 12). Except in this case each number is composed of 2 numbers one of which modifies the mod equation.

So for example you have are given 2 number: 5 (3+2) and 4(3+1) so when you put them into the equation it looks like this:

(x - 2) mod (3+2) = 0 and:

(x - 1) mod (3+1) = 0

Lcm for these 2 numbers in this case 17 because 17-2 mod 5 = 0 and 17-1 mod 4 = 0. I can't use common lcm algorithm for this because result itself is being changed by each number in a unique way.

There is one way to solve in computer which is by running entire loop again every time lcm is changed by a given number. Which is fine with small numbers but it runs into issues when the numbers are in millions. I am asking if there is an another way which I can simplify the process, I really don't know how though.

/r/learnmath Thread Parent