RSA aloghorithm - stuck on d

47 Views Asked by At

I'm sorry in advance if this sort of question has been posted before. I couldn't find it.

I'm clearly an idiot, and I clearly need help, so here I am.

I have a homework assignment which overall is fairly simple but I can't see where I'm going wrong.

The whole idea of said assignment is that encrypt whatever you like with RSA, no code, just pen and paper. I went for a simple A=1, B=2 and so on.

Now here's my problem.

I choose 2 primes:

P = 7079 and Q = 7103

n = 50282137

pi(n)= (P-1)(Q-1) = 7078 * 7102 = 50267956

As far as I understand the small exponent e must be:

1 - be an integer

2 - not a factor of n

3 - 1 < e < pi(n)

I choose e = 321

Which according to Wolframalpha is ok -> https://www.wolframalpha.com/input/?i=gcd%28321%2C49630936%29

d = 2(pi(n)) + 1 / e = (2(50267956) + 1) / 321 = 313195.99065420560747663551401869

Shouldn't d be an integer?

What am I doing wrong here?