Skip to content

Instantly share code, notes, and snippets.

@abdalimran
Created February 12, 2016 19:03
Show Gist options
  • Save abdalimran/30725050117991f159c1 to your computer and use it in GitHub Desktop.
Save abdalimran/30725050117991f159c1 to your computer and use it in GitHub Desktop.
/* Bismillah hir rahmanir raheem. Thanks to Allah for everything.
Coder: Abdullah Al Imran
Email: [email protected] */
#include<bits/stdc++.h>
using namespace std;
//4. Using Euler’s Theorem
vector<int> inverseArray(int n, int m)
{
vector<int> modInverse(n+1,0);
modInverse[1] = 1;
for(int i = 2; i <= n; i++)
{
modInverse[i] = (-(m/i) * modInverse[m % i]) % m + m;
}
return modInverse;
}
int main()
{
ios_base::sync_with_stdio(false);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment