Or rather, take as long as humanly possible to repay them. The government gives huge subsidies to most student loans and you can use the difference between the rate paid to student loans and the rate of return available in the market to your advantage.
I have about $15,000 in student loans that I am paying a 3.43% interest rate on (thats a little more than inflation). I have elected to use the graduated repayment plan so I can accelerate contributions to my ROTH IRA. This means that my monthly payments are $75 instead of $105 (rounded). I then have an auto transfer for the other $70 directly into my IRA for a total of $840 a year. Using this method, I only have to come up with $3,260 to max out my yearly contributions.
If I am able to get greater than a 3.43% return on that money, I will be money ahead at the end of repaying my loans. Although this plan will take me 5 more years to repay my loans, I will still pay the same monthly amount and quite likely end up with a few thousand dollars at the end.
This holds true even if i put the extra money into a taxed account and use the accumulated money to pay the last 5 years of my debts. For instance, at 30% taxes with 50% portfolio turnover each year and a return rate of 5% and withdrawing the money to repay the student loans in years 10-15, you would have $639.75 in additional money at the end of the 15 years while having the exact same monthly decrease in available cash (Paycheck - Student Loan - Money put into brokerage account). If you earned the historical average 10% by investing in stocks and moved the money into more conservative investments yielding 5% in years 10 to 15 you would have $2,900 at the end of the time.
Still assuming a taxed account, if you forgot about that money and didn't use it to pay the monthly amounts in years 11-15 but still didn't put any more into the account in years 11 to 15 and got 10% yearly returns, then you would end up with $15,272 at the end of 15 years. In an untaxed account that amount would be $17,861.
However you cut it - $639.75 for almost no risk; $2,900 for market matching returns; or $17,861 if you keep paying loans out of your paycheck - if you are self disciplined enough to set up an automatic payment then you are better off taking as long as possible to repay your student loans. It all goes back to opportunity cost, and the government has quite nicely given us all a subsidized opportunity in this case.
You can run these calculations for yourself by downloading the excel file I have created here. Be honest with yourself, however. If you aren't self disciplined enough to transfer the money every month, then you aren't necessarily going to be money ahead using this strategy.