Apologies for what may be a simple question, but I don't have a background in mathematics beyond high school.
I'm trying to work out a formula, that when given a number, say
2, to treat this as "number of digits" and calculate the largest possible integer.
For example :
2, then largest number possible is
3, then largest number possible is
4, then largest number possible is
My quick and dirty solution (programmers hat on here), is to just count upwards from
0 to the given number, appending
9, and returning the result, however there must be a mathematical formula that can do this in a cleaner and more efficient manner.