x = HexSectorSize
Total Hexes = 3x^2 + 3x +1
It's exactly the right formula. HexSectorSize is the radius of galaxy minus 1 (the central hex) and also the galaxy's edge length minus 1 ('cause first hex is also the last of previous edge)
Here a little explanation of where the formula comes from and an update with the latest MapSizeDefs.xml:
To know how many hexs counts my galaxy, I've to calculate my central hex (1) plus the number of hexs added by each ring of hexs from the centrum to the last edge. We can quickly see that each new ring adds 6 hexs more than the previous ring.
So first ring (2) brings 6 hexs (6 because central poly is an hexagone), second ring (3) 12 hexs, third ring 18 and so on.
We can write 1 hex (central hex) + 6 x 1 (first ring) hex + 6 x 2 (second ring) hex + ... + 6 x n (n = number of rings) hex
To simplify, we have 1 hex + 6 x ( 1+2+...+n) hex = total number of hexs in given galaxy
To know what gives 1+2+3+...+n where n could be egal to 1 million if we want, the best way is to consider it like a stair and use geometry.
Then, for example 1+2+3+4 :
When I add a copy of my stair upon the initial stair I get a rectangle of 4 x 5 squares. The principle is to determinate dimensions of our rectangle, I've to take the highest number of my initial stair (here 4) and multiply by itself plus 1 because to make match my stairs and form the rectangle, I have to add a column or a line (here a line). It gives 4 x 5.
Now to come back to the right number of squares in my initial stair, I have to divide by 2 because before I doubled the number of stairs (initial + copy). Just like if you wanted split a rectangle into two egal triangles.
To translate into equation: 1+2+3+4 = (4 x (4+1)) / 2 = 10 (you can count each squares, that's right)
With n: 1+2+3+...+n = (n x (n+1)) / 2
The full equation is 1 (central hex) + 6 (because hexagonal) x (n x (n+1)) / 2 (n is the number of rings) = total number of hexs in galaxy.
We get: 1 + 3 x (n x (n+1)) or simplified 1 + 3n² + 3n
Practical example: Tiny galaxy has 32 HexSectorSize ( =number of rings of hexs)
so you can choose: 3 x 32 ² + 3 x 32 + 1 = 3072 + 96 + 1 = 3169 hexs in tiny galaxy
or: 1 + 6 x (32 x (32+1)) /2 = 1+ 3 x 32 x 33 = 3169 hexs (this one is easier to write in your calculator)
Now the table for each galaxy size:
Denomination HexSectorSize Tiles number
Tiny 32 3169 hexs
Small 50 7651 hexs
Medium 64 12481 hexs
Large 90 24571 hexs
Huge 120 43561 hexs
Gigantic 180 97741 hexs
Immense 250 188251 hexs
Excessive 400 481.201 hexs
Insane 524 (a lot of rings) 825301 hexs
I guess if you conquer the full galaxy you become the Lord of the rings. Cheers