There are two types of NDCs: a product code and a package code.
The product code consists of a two numeric identifiers (called segments) separated by a hyphen: a labeller segment, and a product segment. Currently the labeller segment is four to five digits, and the product segment three or four.
The descriptions posted do not say but observation suggests the segments can be any positive integer. Note that the product code does not contain packaging information.
The package code consists of three segments separated by hyphens: the product code as above, and a package segment. The package segment is currently two digits.
There is a one-to-many relationship between the product and package codes, i.e. zero or more package codes can exist for every product code.
References and Downloads
The FDA National Drug Code Directory is here.
The latest NCD database downloads are here.
NCD product file definitions are here.
NCD package file definitions are here.