Mod Inverse When Coprime

Computer Mathematics Hard 3 views
Back to Questions

Problem Description

Given a and m, print inverse of a mod m, or -1 if not exists.

Input Format

Two integers a m.

Output Format

One integer inverse or -1.

Sample Test Case

Input:
3 11
Output:
4

Constraints

m>1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next