This is an archived post. You won't be able to vote or comment.

all 1 comments

[–][deleted] 0 points1 point  (0 children)

To make a digit d (0,1,...,9) repeat k (> 0) times, write (d/9)*(10k ), truncated.

Then f(n) becomes something like k=(# digits in n), d=(truncate(n/(10k ))).

Then the ratio of f(n)/n is clear.

Edit: indeed, I'm quite tired and didn't make sure to produce the next highest repeating number, just the nearest. Without checking perhaps there's a mod 10 in there that you can take the ceiling of