Does a factory reset also format device, or just delete and remove indexes? I am just wondering when using the option erase all content and data how this is done from a system side, does it format a partition on the memory or does it just delete it remove indexes like a normal delete? I would imagine the system files are pretty much untouched? Example scenario I am imagining here is;
A) system partition 2GB ish 
B) recovery partition, no idea 
C) user space, everything else 
So when a factory reset happens does C have it's data deleted or just totally formatted?
If the later would it skip empty cells on a format?
For example Joe Bloggs gets a new iPhone, usage is 20gb/120gb. 3 days later factory resets it, does it use one of the flash memories finite writes on the entire partition  using limited writes or skip over it and write over just the 20gb? I am assuming here that the memory in each iPhone cell can take around 20,000 wipes anyway, so would each cell go down to around 19,999 on average or just the cells that used to have data on before the format if there is one?
Actually it is both more complicated as well as simpler!
When you choose to erase all contents from the device, the only thing overwritten and deleted is the encryption key for the device. Without the key, the contents of the disk drive is no longer accessible to anyone, and is thus treated as being equivalent with it being deleted.
In your example, neither 120 GB nor 20 GB of data is written to the disk. It is only a very small amount (less than 1 MB) that is written. Namely the encryption key(s) are overwritten, and the drive is formatted a new (which only writes certain data structures to the drive - it does not as such overwrite the old data contents of the drive, neither used or non-used).