EDIT: "Each tile is 256 pixels square and the number of tiles across at each zoom level is given by this formula: Math.pow(2, zoom)"; ops I missed the word "across" :)
How did you come up with that number? The sum loop that follows reports 524287 tiles total.
#include <stdio.h> #include <math.h> int main(void) { int i; double tot = 0; for(i = 0; i <= 18; ++i) tot += exp2(i); printf("tot %f\n", tot); return 0; }