It's not entirely clear what you are doing here, but I assume you are trying to adjust the write pointer in your output buffer according to the number of characters taken by the sprintf calls.
sprintf returns the number of characters actually written into the output buffer, so instead of incrementing your pointer by a guessed number of characters, use the return value.
numWritten = sprintf(result, "%d ", number);
memory += numWritten;
I assume that memory is a char*; you would also get unexpected results if it was a pointer to some other type because the arithmetic is affected by what the pointer is pointing to.