C (gcc), 40 39 32 bytes
Saved 7 bytes using formula from xnor's Python answer!!!
f(n){n=n>9?10*f(n/10):5>>5/-~n;}
Recursively calls itself, multiplying the returned value by \$10\$ and chopping the last digit off \$n\$ until \$n\$ is \$9\$ or less. Then returns one of \$\{1,2,5\}\$, whichever lays just below or equal to \$n\$ using xnor's formula.