#J, 22 bytes
J, 22 bytes
-6 bytes thanks to frownyfrog
I.~0+/\@,1%2*1+[:i.9&^
##original answer
original answer
Luis's answer in J:
1+]i.~[:<.[:+/\1%2*1+[:i.9&^
Ungolfed
1 + ] i.~ [: <. [: +/\ 1 % 2 * 1 + [: i. 9&^
Mostly curious to see if it can be drastically improved (cough paging miles)
Explanation
1 + NB. 1 plus...
] i.~ NB. find the index of the arg in...
[: <. NB. the floor of...
[: +/\ NB. the sumscan of...
1 % NB. the reciprical of...
2 * NB. two times...
1 + NB. 1 plus...
[: i. NB. the integers up to
9&^ NB. 9 raised to the power of the arg