For the hexagonal close-packed structure the derivation is similar. Here the unit cell (equivalent to 3 primitive unit cells) is a hexagonal prism containing six atoms (if the particles in the crystal are atoms). Indeed, three are the atoms in the middle layer (inside the prism); in addition, for the top and bottom layers (on the bases of the prism), the central atom is shared with the adjacent cell, and each of the six atoms at the vertices is shared with other six adjacent cells. So the total number of atoms in the cell is 3 + (1/2)×2 + (1/6)×6×2 = 6. Each atom touches other twelve atoms. Now let be the side length of the base of the prism and be its height. The latter is twice the distance between adjacent layers, i. e., twice the height of the regular tetrahedron whose vertices are occupied by (say) the central atom of the lower layer, two adjacent non-central atoms of the same layer, and one atom of the middle layer "resting" on the previous three. Obviously, the edge of this tetrahedron is . If  , then its height can be easily calculated to be , and, therefore,  . So the volume of the hcp unit cell turns out to be (3/2)  , that is 24   .
It is then possible to calculate the APF as follows: