How long we need to prepare very much depends on the target.
A few key points:
The RKKV is under power. Meaning its nuclear pulse engine is still active and it's presumably on automatic guidance to hit Earth. It has been adjusting its trajectory during its approach to the solar system and is likely already on its final course.
We cannot accelerate anything substantial to those velocities, that's simply not something we have the tech for, maybe if we survive the strike we might be able to build something like the RKKV ourselves, but it'd be an extraordinary venture.
In the current description, we have about a month before impact, that's nowhere near enough to do anything useful beyond hurling a "black box" of sorts containing information and maybe biological samples into orbit.
But assuming we have prior warning, some time-traveller or whathaveyou has told us it's coming and we know where and when.
We have a few options.
- Evade it
- Hunker Down
- Destroy it
- Divert it
Evading is self-evidently impossible, if we could move our planet out of the way we would laugh at the problem of stopping a weapon like this. However this option does encompass escaping using every spacecraft available and attempting to restart humanity in space or on another planet, not infeasible, and if we were in a real desperate money-no-object hurry we could conceivably put enough material and people into space for a sustainable community.
Hunkering down, our current most reasonable option, build bunkers, stockpile resources, batten down the hatches and pray. Even something is catastrophic as an RKKV is unlikely to kill everyone, survivors with enough resources and time can rebuild the world.
Destroying it is not possible, not in isolation, we're talking about a million tons in a vacuum. However its velocity gives us some options, at 3.5% of the speed of light it has a hell of a lot of energy behind it. So we can put something reasonably chunky in front of it and watch it produce an explosion bigger than anything we've ever made before. No nukes required. The only question is whether that will appreciably disperse its mass before it reaches us.
Unlikely.
Our better option is to Divert it using the same method. Instead of planting something big in its path, we instead smack something big into it at an angle, Clip it edge-on with an asteroid perhaps. The blast will be off-center from the RKKV's center of mass and therefore divert its course. Alternately we could outright hit it in the side with our asteroid, assuming we could nudge one hard enough and accurately enough to hit such a fast moving target.
We would need to set this in motion a long time in advance and be prepared for the target to make minor course-corrections to avoid the asteroid.
That last point is one possible weak-point though.
The RKKV is able to adjust course, it has to be. Nobody wants to launch a weapon, wait 100 years only to realise it smacked into an asteroid they didn't realise was there.
While it undoubtedly did its final course corrections before we even saw it, the hardware is still there. Meaning that if its control-systems detect an obstacle it should automatically take steps to evade. So we could potentially mess with it by pushing asteroids into its path and forcing it to recalculate its course until it's too late and it misses.
More directly, if we can establish any kind of communications with its guidance systems (or spoof its telemetry) we could force it off course using its own thrusters. It wouldn't take much to make it miss.
Time-frames:
Evade - The more time, the better, but as things stand, we could put a crate of frozen embryos and seeds into space within a few weeks if we had to.
Hunker Down - The more time, the better. Right now the main goal would be to stock up and shift our infrastructure to be more robust, years ideally, but we could make do with the few weeks given in the initial question.
Destroy it/Divert it - hitting it at a distance that would make a difference requires literal years of flight-time for any projectile, assuming it can't change course to avoid. Whether the goal is to divert it or not. We'd want to hit it outside the orbit of Jupiter at least. for comparison, the Galileo space probe made the flight to jupiter in Six Years. Call it ten years because we need time to build and test the mission beforehand.
Spoofing using asteroids to force course-corrections would be a huge project, we're talking a decade at minimum to fit asteroids with the engines and guidance systems to do what we'd need. This is also not a surefire method because we're assuming the RKKV is going to try and alter its course at all, it may simply smash through any obstacle we're able to move.
However the plans to electronically spoof it or directly gain control over its telemetry have some promise, ideally a couple months or more should be enough to do it via radio signals and experimentation. Though it does very much rely on the RKKV being able to listen for telemetry instructions, which it may not be doing. If this is the plan, it's a gamble and should be done in parallel to other options.
This also relies on it being within communication's range, something we will struggle to achieve much beyond the heliosphere. so that sets a hard limit on our time-frame for this at about three weeks.
Dunno about you, but the prospect of hacking into an alien flight-telemetry system using a ping-time of upwards of a day, figuring out any encryption and security systems and working out how to send legitimate commands..all in the space of about a week and a half (to do it before the RKKV passes through jupiter's orbit) utterly terrifying. I mean, no pressure right? it's only the planet :P
That'd be a hell of a movie though.