How many qubits are required to break RSA 2048 or 4096 with a universal quantum computer?
How many qubits are required for breaking RSA 2048 and RSA 4096 in real-time with a quantum computer?
  


Like the answer you linked to shows, about $\log_2(N^2) = 2 \log_2(N)$ or just $2n$ where $n$ is the number of bits of the modulus $N$, i.e. the key size of RSA. So 4096 for 2048-bit RSA, double that for 4096-bit.

This paper (PDF) has an algorithm using $2n+3$ qubits, where $n=\log_2 (N)$, where $\log_2(N)$ is the way to calculate the number of bits in $N$.


  
  How many qubits are required to break Curve25519?
  


Breaking elliptic curves requires (pdf, see 6.2) roughly $6n$ qubits where $n$ is the order or key size of the curve, which for Curve25519 would be $6 * 255 = 1530$. Less than secure RSA sizes require, but much more than has been accomplished.


  
  I want to work out the relationship between the key length and number of qubits required to break that key length.
  


See above.




  Edit: I have found this answer. Anyway if I plug in N = 2048 to the Θ(log(N^2)) equation, this gives me 15.25 qubits required to factor RSA 2048. RSA 4096 bits is not much better, requiring only 16 qubits. Is that correct?! Why is everyone not running around with their hair on fire?


You are using the wrong value for $N$. It is the modulus, not the bit length. The actual number of qubits needed for 2048-bit RSA is about 4096.



Note (from removed comment to the present answer):  We're talking about ideal qubits here. Error correction might increase the number of physical qubits beyond these numbers.