Is there a fast way to solve a modular equation? As far as I know, it's solvable with brute force.
For instance, for the equation (x +
≡ 3 (mod 4), it's:
For x=1: (1 +
≡ 3 (mod 4) => 9 ≡ 3 mod (4) which is false. (Remainder: 1)
For x=2: (2 +
≡ 3 (mod 4) => 10 ≡ 3 mod (4) which is false. (Remainder: 2)
For x=3: (3 +
≡ 3 (mod 4) => 11 ≡ 3 mod (4) which is true.
You keep trying for n-1 amount of times until you've found such x which returns true. But, I need someone to refute me as I'm not good at math.
The problem with the OP question is that there are an infinite number of answers.
Lets look at an example using smaller numbers to better understand...
instead of multiplying by 64, let's multiply by 7
Instead of using the order of secp256k1 for the divisor, let's use 11.
Now if we choose 5 for the starting number, we get:
(5 * 7) % 11 = 2
However, if we look at (k * 7) % 11 = 2 there are an infinite number of solutions for k
k=5
k=16
k=27
k=38
k=49
k=60
k=71
etc.
This was presented as:
"little algebra" and if we are going to answer it as a question about algebra, then there are an infinite number of answers to the question.
What we end up with in my example is the equation: 7x = 11y +2
And the OP is asking how to solve for x.
There is a different answer for x for every one of the infinite possible values of y.
Since the OP said "as integer" I'm assuming he's looking for all the integer values of y that result in an integer value of x.
So:
y = 3, x = 5 (which is where I got the k=5 above)
y = 10, x = 16 (which is where I got the k=16 above)
y = 17, x = 27 (which is where I got the k=27 above)
y = 24, x = 38 (which is where I got the k=38 above)
The OP keeps on asking silly questions like these instead of explaining what he's actually trying to do or why the answer to his question matters. In most every case, the question he asks is not the question he actually wants the answer to.