Let’s assume that you work at an awesome company as a contractor.
They allow you to purchase equipment, and will reimburse the money you spent.
However, as a freelancer, you have to pay taxes. Let’s assume taxes are at 10% for any payment you receive on your account.
To further increase the greatness of the company, they say they will pay the taxes for you as long as you do the proper calculation.
So, as an example, let’s say you spend like $100 on computer equipment and ask for $100 reimbursement.
You will receive $100 on your bank account and have to pay 10% of that in taxes, so that’s $10, so you end up with $90.
You might also try to ask for $110 from the company, but 10% of that is $11 so you are left with $99. If you ask them to send you $11 for the taxes you paid, you will again have to pay 10% of $11 ($1.1) in taxes, and so on.
So the question is, how much money should the company reimburse you once, so that you get an amount close to the one you spent which includes taxes?
The answer is, if N is the money spent, you need to ask for reimbursement of money.
As an example:
I spend: $100
They send: , or $112
I pay tax: 10% * $112 = $11.2
Now, it holds that
To derive that formula, we need to think in terms of recursion. Consider that multiple transactions are made, and for each transaction, you need to pay 10% in taxes of the transaction value.
Start with a number N:
1. Ask for pay of N money (company reimburses N)
2. Ask for pay of 10% of N (company reimburses 10% of N)
3. Ask for pay of 10% of 10% of N (company reimburses 10% of 10% of N)
And then, sum all the terms.
That makes something like: .
To calculate the part, we can let . So, and and we get that . We rewrite that as so that we can use ceil on the fractional part to get an integer.
P.S. I work at Automattic 🙂