Consider the sequence such that and for every positive integer ,
, where is the largest prime factor of .
The first few terms of the sequence are . What is the largest value of such that is a four-digit number?
Note: This is adapted from a Mathematics competition. Happy solving; From Issac Newton,