International Residential Code (IRC) has a table for that.
Chapter 7 - Wall Covering
SECTION R702 INTERIOR COVERING
R702.3 Gypsum board.
R702.3.5 Application. Maximum spacing of supports and the size and spacing of fasteners used to attach gypsum board shall comply with
Table R702.3.5. Gypsum sheathing shall be attached to exterior walls
in accordance with Table R602.3(1). Gypsum board shall be applied at
right angles or parallel to framing members. All edges and ends of
gypsum board shall occur on the framing members, except those edges
and ends that are perpendicular to the framing members. Interior
gypsum board shall not be installed where it is directly exposed to
the weather or to water.

For SI: 1 inch = 25.4 mm.
a. For application without adhesive, a pair of nails spaced not less
than 2 inches apart or more than 21/2 inches apart may be used with
the pair of nails spaced 12 inches on center.
b. Screws shall be in accordance with Section R702.3.6. Screws for
attaching gypsum board to structural insulated panels shall penetrate
the wood structural panel facing not less than 7/16 inch.
c. Where cold-formed steel framing is used with a clinching design to
receive nails by two edges of metal, the nails shall be not less than
5/8 inch longer than the gypsum board thickness and shall have ringed
shanks. Where the cold-formed steel framing has a nailing groove
formed to receive the nails, the nails shall have barbed shanks or be
5d, 131/2 gage, 15/8 inches long, 15/64-inch head for 1/2-inch gypsum
board; and 6d, 13 gage, 17/8 inches long, 15/64-inch head for 5/8-inch
gypsum board.
d. Three-eighths-inch-thick single-ply gypsum board shall not be used
on a ceiling where a water-based textured finish is to be applied, or
where it will be required to support insulation above a ceiling. On
ceiling applications to receive a water-based texture material, either
hand or spray applied, the gypsum board shall be applied perpendicular
to framing. When applying a water-based texture material, the minimum
gypsum board thickness shall be increased from 3/8 inch to 1/2 inch
for 16-inch on center framing, and from 1/2 inch to 5/8 inch for
24-inch on center framing or 1/2-inch sag-resistant gypsum ceiling
board shall be used.
e. Type X gypsum board for garage ceilings beneath habitable rooms
shall be installed perpendicular to the ceiling framing and shall be
fastened at maximum 6 inches o.c. by minimum 17/8 inches 6d coated
nails or equivalent drywall screws.