I get different results for d in test cases 2, 3, and 4 (in particular, d=929660805638728623653 for test case 2).
This was my first Cody problem and I had a mistake in the assert within the test cases. I fixed the problem. Previously the assert was looking for [n,d] combined into a single character array. I have tested the test cases and they are correct. You should use the Euclidean algorithm.
If I understand correctly, we should have mod(d*e,phi)=1, where phi=(p-1)*(q-1). My answers seem to satisfy that condition, but test cases 2, 3, and 4 do not.
Tim, you are absolutely correct. Thanks for the comment. I fixed the test cases.
Googling can supplant programming sometimes.
Back to basics 22 - Rotate a matrix
768 Solvers
middleAsColumn: Return all but first and last element as a column vector
394 Solvers
Given a window, how many subsets of a vector sum positive
755 Solvers
281 Solvers
139 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!