I'm working on a problem set for a class on intro computing and cryptography. I'm being asked to find the $n = pq$, where $p,q$ are integers (not necessarily prime), such that $\phi(n)=$
$2961663103295106586664292574860370$ $9646682909251496874286611652662276888867730054361987$ $0132065232070766756540945872699698884632550737457957$ $60212647480948122249224121531406021196015733929413333$ $931614086054218206830599157256559770960$
for an absurdly large $n$ =
$296166310329510658666429257486037096466829092514968$ $74286611652662276888867730054361987013206523207076675654095484773927425$ $6896134970395727031935392790447797391203973441361$ $72609641046823030764012972259401809379112646137930136087303$
The problem asks me to to write a computer program in Sage that will enable one to solve for $p,q$.
My strategy so far is to create a program that first divides both $\phi(n)$ and $n$ by each prime number successively only if the prime evenly divides itself in order to break it down into prime factors. The idea I had here was that it would allow me to get closer to finding $p$ and $q$. I was thinking of then using the multiplicative property of the $\phi(n)$ function to check that $\phi(n) = \phi(p)*\phi(q)$. Besides this, I'm not sure how else to approach this problem. Any advice would be appreciated.
Using an RSA recovery algorithm I get
with probable primes $p,q$ and indeed $n=pq$ and $\phi(n)=(p-1)(q-1)$. I use Algorithm 18.16 (Special integer factorization) from the solution to exercise 18.12 (ii) of J. v. zur Gathen, J. Gerhard, Modern computer algebra, 2nd ed., 2003, available online as http://www-math.uni-paderborn.de/mca/solutions.ps.gz