Relativistic kinematics: when will a photon and spaceship meet?

Hello to everyone! I cane across this problem and since I have no training in SR I can’t solve it on my own, That is why I would very mutch apprecitate any help I could get.

The problem:
A photon and a spaceship simultaneously start at planet A and the travel in paralal towards planet B. The spaceship travels at speed c/n where n>1. The distance between A and B is d. When the photon reaches planet B it gets reflected back to A by a mirror.

The Question:
At what time will the rochet and the spaceship meet since started from planet A?
The clock to measure time is inside the rocket it’s self.

Attemting a solution (propably wrong)
The clock is on the spaceship, therefore we are looking at the system from the spaceships frame of reference.
Lorentz-contraction occours :
d’ = d √1-(v^2/c^2)

The maximum distance the photon can travel is 2d ; from A to B then back. (the spaceship could move with extreemly slow speeds, almost standing.)
The maximum distance the spaceship can make, is d ; from A to B (because the photon turns around at B making this point theoretically the farthest point where they can meet.)

If I calculate the the time needed for the photon to travel that distance taking into account the Lorentz-contraction, and then subtract the time needed for the rocket to travel the max distance, i get the time of meeting?
Photon: t= 2d’/c
Spaceship: t=d’/(c/n)
Therefore: t=2d’/c – d’/(c/n) Is this correct?
Thank you.

Show Buttons
Hide Buttons