|
|
|
|
|
by relix
5000 days ago
|
|
I'm not sure I understand how a speed benefit would be had here, since to get number N+1 they still need to retrieve (and/or calculate) number N-1. The difference between getting (N and N-1) or only N-1 is negligible, especially for large n, unless I'm missing something? It's not really more parallelizable either. |
|
The benefit would be there, if Dickens went one step further, and used Math.pow to get the result instead of loop (that is - assuming calculating the power is faster than doing a loop (but it should be - you can square a few times to get near the result instead of multiplying "by one factor" each time)).