I'd say not less than 100ft unless you are formation trained, and not less than 30ft unless you are very sharp.
Formation is perfectly legal anywhere so long as the commanders have agreed in advance to do so.
If you are relatively low hours, 500ft is a sensible safe limit however.
G