Party Time!


You're on your way to a party. The flyer for the party reads "3:00pm, Mile Marker 2452, Highway 0. Be there or be squared!"

Cruising at the speed limit (60 mph), you pass a sign which reads

"You can't stop here; this is Math Country (and beginning of Highway 0). All of your maths are belong to us."

"Ah, I must be getting close," you think to yourself. As you approach mile marker 1, you look down at the clock which reads 2:00pm. Uncontrollably you shout, "Marker 1?! You can't be serious! I'm never gonna make it to mile 2452 in an hour!"... or will you? There is also a sign over the intersection at marker 1 which reads:

Intersection every mile-
LEFT to be squared
STRAIGHT to be squared plus one
RIGHT to be incremented by one

You must think ahead. What is the earliest you can legally arrive at the party, and what progression of turns will you take to get there in this time? (For instance, to get to mile marker 7 from mile 1 you can stay straight to go to mile marker 2, then stay straight for mile marker 5, then a right for marker 6, and one more right for marker 7, for a total of 4 miles (4 minutes).)


**Programming Challenge: Don't only think about yourself! Write a program to help others get to their parties as quickly as legally possible. Allow the program to take any natural number mile marker and produce the shortest distance to said marker as well as a progression of turns to get there in this distance. For instance, your program could output something like:

Enter mile marker number for the party: 7
Distance to mile marker 7 is: 4 miles.
Take this route: 2-S, 2-R

(Solution)