Normally digits as such indicate only the basic form or the stem of a cardinal numeral. Thus, any inflection needs to be shown separately, and ordinal numerals need to be distinguished from cardinal numerals with some added notation.
However, there is no way to distinguish between the basic form and the compositive form. when using digits. This means that a notation like 17-vuotias is used independently of the intended reading, seitsemäntoistavuotias or seitsentoistavuotias.
When a number is expressed with digits, it still needs to take the case form required by the context. For example, if the word viidessäkymmenessä (inessive of viisikymmentä, 50) is written with digits, it needs to be 50:ssä. Thus, the digits are followed by a colon and the case suffix. Since this requires grammatical analysis, even native speakers very often make mistakes in this issue.
The following detailed rules apply:
Note that e.g. viittäsataa is written as 500:aa, because the second part is inflected and the suffix is thus taken from it. It is easy to err here, thinking that the second part is not inflected, since we have the nominative and the partitive viisisataa : viittäsataa. The nominative is special since it contains the partitive suffix in the second part. In all other case forms, inflection is normal, e.g. viidelläsadalla = 500:lla.
The rules for ordinal numerals expressed with digits are similar to those for cardinal numerals, except that the ordinal numeral suffix needs to be written, too. Thus, kahdennessakymmenennessä is written as 20:nnessä. Here nne is the ordinal numeral suffix, taken from the last (inflected) part, kymmene|nne|ssä. The nominative kahdeskymmenes is written as 20:s, since here the ordinal numeral suffix is just s. According to the same rules that apply to inflection of cardinal numerals, we write e.g. viidennessätoista as 15:nnessä (taking the suffixes from the first part).
However, if the numeral congrues with the next word, the ordinal numeral can be written using a period after digits, just as in the basic form. The case form will be implied. For example, the expression 7. luokalla is read seitsemännellä luokalla (in the seventh class/grade).
It is very common to use expressions like 7. suurin for “7th largest”. Though ambiguities hardly arise, the writing style is nonstandard, and one should write 7:nneksi suurin, as this is read seitsemänneksi suurin.