Each type of Pokemon needs certain number of candies (of a compatible type) to evolve to the next level. Usually you need either 12, 25, 50, 100 or 400 (Magikarp) to evolve to the next level.
The exact number depends on the Type of the Pokemon as well as its current evolution level. For example Pidgey to Pidgeotto requires 12 Pidgey candies where as Pidgeotto to Pidgeot requies 50.
When looking to evolve Pokemon we often need to ‘transfer’ a few back to the Professor to earn candies before we have enough for the evolution. This is especially true in two cases:
a) Uncommon types (dependent on location etc.): where you will end up having far larger number of that type than you will be able to utilize for evolving. For example in our area there are very few Machop, and for the first level you need 25 Machop candies. Thus I will need to catch 9 Machop before I can evolve 1 Machop! But if I was to transfer I could evolve after catching 7 (giving me 7*3 = 21 Machop candies) and then transferring 4 (giving me 4 Machop candies).
b) Very common types (to maximise evolutions especially if you have a lucky egg activated): where if you have a few hundred Pidgeys (again far few that you can evolve).
In both cases you need a way to calculate, given the current number of a particular type (e.g. for a Pidgey and Pidgeotto are different types even though they are part of the same evolution chain), the number of candies available and the number of candies per evolve – how many extra evolutions you can have by transferring some Pokemon.
The formula is:
ToInteger[(Nt + C) / (1 + Co)] – Nc = Ne
Nt = Number of currently present Type
C = Number of currently available Candies
Co = Number of Candies required for next Evolve
Nc = Number of possible Evolves without Transferring
Ne = Number of extra evolutions possible by transferring Pokemon
Let us assume you have 103 (C) Eevee candies. Now each evolution of Eevee (which has only a single level) requires 25 (Co) Eevee candies. Let us assume we have 30 (Nt) Eevee with us.
Nc = ToInteger(103/25) = 4
ToInteger[(Nt + C) / (1 + Co)] = ToInteger[5.11] = 5, thus Ne = 5 – 4 then Ne = 1
Which means we can return Eevees to get one additional evolve!
Now we need to find out exactly how many Eevees we need to return to achieve that one additional evolve – while making optimal use of existing Eevee candies. The so called Equilibrium condition is that we have no un-evolved Eevees or unused Eevee candies after the evolutions.
The formula for Number of Returns (Nr):
Nr = [(Ne + Nc)*Co] – C
From the example above we have: Ne = 1, Nc = 4, Co = 25 and C = 103, which gives:
Nr = [(1+4)*25] – 103 = 125 – 103 = 22
Thus to make optimal use of existing Eevee and Eevee candies we should transfer 22 out of 30 Eevees and utilize the candies gained from transfer to evolve the remaining Eevees.
The result is not at Equilibrium because we will be left with 3 Eevees after we return 22 and evolve 5 [30 – (22+5) = 3].