@raduga_fb
this sounds interesting... furthermore, in that case the solution is unique!
I need more investigations
@wilson bibe
sorry to contradict you but these are the facts, under a programmer approach:
in "C" (max bits used in calculations 7FFFFFFF):
Code:
#include <stdio.h>
void
main(void)
{
int a, mod=67890, c=48765;
for (a=0; a<1295; a++)
if ((a*a*a) % mod != (a*(a*a % mod)) % mod) printf("KO for a=%d\n", a);
}
output is:
KO for a=1291
KO for a=1292
KO for a=1293
KO for a=1294
This means no difference with
a < 1291
using GMP big-integers library:
Code:
void
main(void)
{
mpz_t base, mod;
mpz_t res1, res2, res3, res4;
mpz_init(base);
mpz_init(mod);
mpz_init(res1);
mpz_init(res2);
mpz_init(res3);
mpz_init(res4);
mpz_set_ui(mod, 67890);
for ( ; mpz_cmp_ui(base, 0xFFFFF)<=0; mpz_add_ui(base, base, 1)) {
mpz_powm_ui(res1, base, 3, mod); // (a*a*a) % mod
mpz_powm_ui(res2, base, 2, mod); // (a*a) % mod
mpz_mul(res3, base, res2); // a * ((a*a) % mod)
mpz_mod(res4, res3, mod); // (a * ((a*a) MOD mod)) % mod
if (mpz_cmp(res4, res1))
gmp_printf("KO for a=%Zd\n", base);
}
}
Nothing is printed. This means that there is no difference at all between
(a*a*a) % mod and
(a * ((a*a) % mod)) % mod (at least for base up to 0x100000)
Best regards
bilbo