Is there a simple way to add a zero in between a 4 digit number?

37 Views Asked by At

I want some formula which can take as an input a 4 digit number and outputs a 5 digit number. This 5 digit number is actually the input with a zero in between. Example: input: 1234 -> output: 12034 input: 6570 -> output: 65070 ...

1

There are 1 best solutions below

0
On BEST ANSWER

How about $n \mapsto n+900(\lfloor\frac{n}{100}\rfloor)$ ?

Edited to add: I don't know whether this is the most computationally efficient formula. Now that I'm thinking about it, the question of efficiency is quite interesting, but I don't have the expertise to know whether I could have done better.