4
Given positive integer n
and e
, knowing that e<n
and that n
is the product of two different odd primes(but the primes are not directly given to you), find such a positive integer d
smaller than n
that, for each integer m
, (me)d ≡ m (mod n).
Your program should handle n
up to 24096 in 1TB space, but not necessary reasonable time. You can assume such a d
exist.
Sample Input: n=53*61=3233, e=17
Sample output: d=413
Note that your program will not be given the prime factor of n
.
Shortest code in bytes win.
1Is
n
given to us via its prime factors as in the sample input? May we assumen
is odd? – xnor – 2018-03-26T05:59:15.870@xnor Challenge edited. – user202729 – 2018-03-26T09:53:13.797
(now the challenge had been clarified, there is no reason to close as unclear) – user202729 – 2018-03-26T09:53:59.607
Are we guaranteed that
e>1
? – xnor – 2018-03-26T10:34:44.500@xnor Apart from making the problem trivial, is there any other problems with it? May some algorithm only work correctly with
e>1
(except one that start brute-forcing at2
, but I don't think that's very special)? – user202729 – 2018-03-26T10:57:23.947@user202729 No problems, it's was just a corner case for a golfed I was looking it. – xnor – 2018-03-26T11:01:54.313
For solutions that don't work for some special cases, just make note about that – l4m2 – 2018-03-26T16:05:08.930
1
We requires every solutions equally, or, bonuses in code-golf are bad.2
Because the site is based on [se], having too many poorly-received questions can cause you to be question-banned, while they are not even questions. That's a limit of [se], not PPCG.3
(about the colliding ball challenge) Putting puzzles (solve an equation) in the challenge is often discouraged, because once the first person post their answer, otherusers can just use that approach. Not to say that puzzles are always bad, however. – user202729 – 2018-03-27T00:48:44.000